Suppose I have the following directory structure in Vim's NERDTree:
/some/folder/
|-apples.txt
|-bananas.txt
|- ...
|-mandarins.txt
|-mangos.txt
|- ...
|-strawberry.txt
`-watermelon.txt
My cursor is on the top directory and I would like to jump to mandarins.txt
. How can this be accomplished with as few keystrokes as possible?
NERDTree window contains a special buffer with
filetype=nerdtree
.Within this window/buffer, NERDTree remaps your keys.
You can still use the
/pattern
to search pattern.Hit Enter on a filename, will open it.
You can type /mand, then hit Enter twice.
I did not fully like the solution of searching, since it highlights your search in all your open windows and I think 'jumping' should be possible with fewer keystrokes.
So, thanks to the input of kev and epsilonhable, I wrote a simple filetype plugin by putting the following script in
~/.vim/ftplugin/nerdtree.vim
:Now I can jump to
mandarins.txt
by pressingnm
.