nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 2a0578227ebcc334da64f5e93137926388f71ce6
parent 7fbb77c0675b1cea9efbfa2852feb8a3a7c12ac7
Author: Martin Grenfell <martin.grenfell@gmail.com>
Date:   Fri, 27 Jan 2012 01:15:48 -0800

Merge pull request #127 from cperl82/keymap-leader-fix2

Make handling of '<>' notation more robust.
Diffstat:
Mplugin/NERD_tree.vim | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -510,11 +510,14 @@ endfunction
 
 "FUNCTION: KeyMap.bind() {{{3
 function! s:KeyMap.bind()
-    " If the key we're trying to map is a special key we must escape the
-    " leading '<', otherwise vim will replace it with the actual keycode
+    " If the key sequence we're trying to map contains any '<>' notation, we
+    " must replace each of the '<' characters with '<lt>' to ensure the string
+    " is not translated into its corresponding keycode during the later part
+    " of the map command below
     " :he <>
-    if self.key =~# '^<'
-        let keymapInvokeString = substitute(self.key, '^<', '<lt>', '')
+    let specialNotationRegex = '\m<\([[:alnum:]_-]\+>\)'
+    if self.key =~# specialNotationRegex
+        let keymapInvokeString = substitute(self.key, specialNotationRegex, '<lt>\1', 'g')
     else
         let keymapInvokeString = self.key
     endif