Shortcut to open file in Vim
I want to open a file in Vim like in Eclipse using Ctrl + Shift + R, or via the Ctrl + N option of autofill. Invoke a keyboard shortcut, type the file name/pattern, and choose from all the matching files names.
I know opening it normally like:
:tabe <filepath>
:new <filepath>
:edit <filepath>
The problem here is that I have to specify the whole file path in these cases.
What I normally do is e .
(e-space-dot) which gives me a browsable current directory - then I can /
- search for name fragments, just like finding a word in a text file. I find that generally good enough, simple and quick.
I recently fell in love with fuzzyfinder.vim ... :-)
:FuzzyFinderFile will let you open files by typing partial names or patterns.
:find
is another option.
I open vim from the root of my project and have the path
set to there.
Then, I can open files located anywhere in the tree using:
:find **/filena< tab >
Tab will autocomplete through various matches. (**
tells it to search recursively through the path).
You can search for a file in the current path by using **
:
:tabe **/header.h
Hit tab to see various completions if there is more than one match.