Find a file (via recursive directory search) in Vim

Is there any way to search a directory recursively for a file (using wildcards when needed) in Vim? If not natively, is there a plugin that can handle this?


You can use wildcards with the :edit command. So,

:e **/test/Suite.java

will open test/Suite.java no matter where it is in the current directory hierarchy. This works with tab-completion so you can use [tab] to expand the wildcards before opening the file. See also the wildmode option for a way to browse through all possible extensions instead.

Another trick is to use

:r! find . -type f

to load a list of all files in the current directory into a buffer. Then you can use all the usual vim text manipulation tools to navigate/sort/trim the list, and CTRL+W gf to open the file under the cursor in a new pane.


There is a find command. If you add ** (see :help starstar) to your 'path' then you can search recursively:

:set path

will show you your current path, add ** by doing something like

:set path+=**

then you can just type

:find myfile.txt

and it opens magically!

If you add the set command to your .vimrc it'll make sure you can do recursive search in future. It doesn't seem to search dot directories (.ssh for example)


I'd recommend ctrlp.vim. It's a very good plugin, ideal to work inside large projects. It has search by file name or full path, regexp search, automatic detection of the project root (the one with the .git|hg|svn|bzr|_darcs folder), personalized file name exclusions, and many more.

Just press <c-p> and it will open a very intuitive pane where you can search what you want:

enter image description here

It's possible to select and open several files at once. It also accepts additional arbitrary commands, like jump to a certain line, string occurrence or any other Vim command.

Repo: https://github.com/kien/ctrlp.vim


vim as a builtin find command (:help find) but only open the first found file. However you can use this amazing plugin : FuzzyFinder which does everything you want and even more


You can browse the file system with :ex ., but I do not know how to search recursively (I am a Vim novice — I have been using it only ten years).

There are a few popular file browsers plug-ins:

  • NERD tree
  • Lusty explorer
  • vtreexplorer

See also this thread on SuperUser.