Allow modification of menu keybindings (#923)

This commit is contained in:
Arvid Gerstmann 2018-11-29 15:17:39 +01:00 committed by Phil Runninger
parent 370eb5bcb4
commit c905a5d7b8
3 changed files with 21 additions and 3 deletions

View File

@ -605,6 +605,22 @@ menu item to execute executable files.
Related tags: |NERDTree-m| |NERDTreeApi| 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* 3. Customisation *NERDTreeOptions*

View File

@ -49,7 +49,7 @@ endfunction
"FUNCTION: MenuController._echoPrompt() {{{1 "FUNCTION: MenuController._echoPrompt() {{{1
function! s:MenuController._echoPrompt() 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 "==========================================================" echo "=========================================================="
for i in range(0, len(self.menuItems)-1) 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 "change the selection (if appropriate) and return 1 if the user has made
"their choice, 0 otherwise "their choice, 0 otherwise
function! s:MenuController._handleKeypress(key) function! s:MenuController._handleKeypress(key)
if a:key == 'j' if a:key == g:NERDTreeMenuDown
call self._cursorDown() call self._cursorDown()
elseif a:key == 'k' elseif a:key == g:NERDTreeMenuUp
call self._cursorUp() call self._cursorUp()
elseif a:key == nr2char(27) "escape elseif a:key == nr2char(27) "escape
let self.selection = -1 let self.selection = -1

View File

@ -148,6 +148,8 @@ call s:initVariable("g:NERDTreeMapToggleZoom", "A")
call s:initVariable("g:NERDTreeMapUpdir", "u") call s:initVariable("g:NERDTreeMapUpdir", "u")
call s:initVariable("g:NERDTreeMapUpdirKeepOpen", "U") call s:initVariable("g:NERDTreeMapUpdirKeepOpen", "U")
call s:initVariable("g:NERDTreeMapCWD", "CD") call s:initVariable("g:NERDTreeMapCWD", "CD")
call s:initVariable("g:NERDTreeMenuDown", "j")
call s:initVariable("g:NERDTreeMenuUp", "k")
"SECTION: Load class files{{{2 "SECTION: Load class files{{{2
call nerdtree#loadClassFiles() call nerdtree#loadClassFiles()