Question

Since ? is usually used to search strings upwards I'd love to be able to use this also in NERDTree.

Using ? in NERDTree always brings me to help, but I just want to search upwards and don't want to cycle through the whole tree with / (downwards search)

Était-ce utile?

La solution 2

NERD_Tree provides a way to change its default mappings via global config variables. Just put the following into your ~/.vimrc to change it to F1:

:let g:NERDTreeMapHelp = '<F1>'

Autres conseils

NERD_Tree sets a custom filetype when it creates its window. You can hook into that with an :autocmd that removes the buffer-local mapping for ?. Unfortunately, it apparently sets the filetype before setting up it's mappings, but something like this should work (except for directly after opening the tree for the first time):

Put the following into your ~/.vimrc:

:autocmd FileType nerdtree autocmd WinEnter,CursorHold <buffer> silent! nunmap <buffer> ?

Edit: I've just submitted a patch to the author that would enable this shorter and better hook (though the config variable would still be preferred for this particular use case):

:autocmd FileType nerdtree silent! nunmap <buffer> ?
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top