nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit c905a5d7b87051e574c2e72fae57e56c456ba2f4
parent 370eb5bcb44d7df6cd4512e05d4511fd479497d7
Author: Arvid Gerstmann <ag@arvid.io>
Date:   Thu, 29 Nov 2018 15:17:39 +0100

Allow modification of menu keybindings (#923)


Diffstat:
Mdoc/NERDTree.txt | 16++++++++++++++++
Mlib/nerdtree/menu_controller.vim | 6+++---
Mplugin/NERD_tree.vim | 2++
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/doc/NERDTree.txt b/doc/NERDTree.txt
@@ -605,6 +605,22 @@ menu item to execute executable files.
 
 Related tags: |NERDTree-m| |NERDTreeApi|
 
+------------------------------------------------------------------------------
+                                                              *NERDTreeMenu-j*
+Default key: j
+Map option: NERDTreeMenuDown
+Applies to: The NERD tree menu.
+
+Moves the cursor down.
+
+------------------------------------------------------------------------------
+                                                              *NERDTreeMenu-k*
+Default key: k
+Map option: NERDTreeMenuUp
+Applies to: The NERD tree menu.
+
+Moves the cursor up.
+
 ==============================================================================
 3. Customisation                                             *NERDTreeOptions*
 
diff --git a/lib/nerdtree/menu_controller.vim b/lib/nerdtree/menu_controller.vim
@@ -49,7 +49,7 @@ endfunction
 
 "FUNCTION: MenuController._echoPrompt() {{{1
 function! s:MenuController._echoPrompt()
-    echo "NERDTree Menu. Use j/k/enter and the shortcuts indicated"
+    echo "NERDTree Menu. Use " . g:NERDTreeMenuDown . "/" . g:NERDTreeMenuUp . "/enter and the shortcuts indicated"
     echo "=========================================================="
 
     for i in range(0, len(self.menuItems)-1)
@@ -71,9 +71,9 @@ endfunction
 "change the selection (if appropriate) and return 1 if the user has made
 "their choice, 0 otherwise
 function! s:MenuController._handleKeypress(key)
-    if a:key == 'j'
+    if a:key == g:NERDTreeMenuDown
         call self._cursorDown()
-    elseif a:key == 'k'
+    elseif a:key == g:NERDTreeMenuUp
         call self._cursorUp()
     elseif a:key == nr2char(27) "escape
         let self.selection = -1
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -148,6 +148,8 @@ call s:initVariable("g:NERDTreeMapToggleZoom", "A")
 call s:initVariable("g:NERDTreeMapUpdir", "u")
 call s:initVariable("g:NERDTreeMapUpdirKeepOpen", "U")
 call s:initVariable("g:NERDTreeMapCWD", "CD")
+call s:initVariable("g:NERDTreeMenuDown", "j")
+call s:initVariable("g:NERDTreeMenuUp", "k")
 
 "SECTION: Load class files{{{2
 call nerdtree#loadClassFiles()