Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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".

share|improve this answer

You can use GPicker as CtrlP or CommandT alternative (Textmate feature clone) - it is written in C and is very fast, it integrates well with VIM or emacs. Instalation instructions on my blog post.

http://blog.wysocki.org.pl/2012/06/vim-gpicker-sublimetext-2-like-files.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.