How to search a collapsed file item in NERDTree vim plugin?
The filename is not present in NERDTree's buffer so /pattern
won't work. You'll have to use other tools to reach your goal.
If the file is in a directory that is part of Vim's path
you can use :find
like that:
:find filename
:find fil<Tab>
:find pattern
See :help path
for how to add directories.
You can also do :e /path/to/directory<Tab>
.
Using **
you can force Vim to look into subdirectories as well:
:e /path/**/user<Tab>
will allow you to choose from a list of all files starting with user
. That's pretty neat.
If Vim's working directory is the directory of the current buffer (that's not automatic, see :help autochdir
), something like
:e ../../**/*.json
would bring a list of all JSON files in your project. Well, I don't know how your project is laid out but you get the picture.
See :help file-searching
for a detailed explanation.
Alternatively, you could use a plugin. CtrlP is a nice and powerful "fuzzy" file-naviation plugin that does one thing that I find super useful: when invoked, it looks up and up until it finds a VCS "marker" (a .git directory, for example) and uses it a starting point for your search. This makes opening files in the current project almost "fun".