NERDTree
is my best vim plugin. To find a file or directory item, I move to my cursor to tree view, and use /
. But I still don't know how to find a file item which be in collapsed(closed) tree. NERDTree
does not support this? How do you do find a file?
How to search a collapsed file item in NERDTree vim plugin
nerdtreevim
Best Answer
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: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: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 likewould 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".