How do you manage big projects (hundreds of files) using only VIM?
I personally start having problems in any larger than small project.
I use FindFile. If you open vim at the root of your project and run :FC .
the plugin will cache all the filenames beneath your cwd. You can then do :FF
to open a completion menu and type the name of the file you want (or rather, the first few letters).
I use a combination of NERDTree (directory sidebar), FuzzyFinder Textmate (go-to-file like TextMate's CMD+T), and Sessions (:h sessions) to help me deal with large projects.
I would suggest using some sessions helper plugin. I would mention what I use, but I'm not satisfied with it yet. Just Google "vim sessions".
One thing to note with getting FuzzyFinder Textmate to work is that it depends on an old version the FuzzyFinder plugin, specifically v2.16. Anything higher and you'll get errors. But it's definitely worth the trouble. While it doesn't have name completion, its search is smart so if I search for fro/time/actionsphp
it will pull up the file apps/(fro)ntend/modules/(time)_tracking/actions/(actions).class.(php)
(parenthesis denote what it's matching). It makes it very easy to pick out files that are only unique by their folder name.
If you are using ctags as other posters have recommended, then make sure you look at the taglist plugin.
Make sure you take the time to read the docs and learn the key bindings. Here are a few to get you started (from the TList window):
I like simple solutions, my favorite way to navigate at the moment is:
Add to ~/.vimrc.local
set path=$PWD/**
Then type this in the editor to find the file anywhere in the current working directory (pwd)
:find user_spec.rb
You can use tab-completion on the filenames to find multiple choices as well, making this TextMate convert very happy.
Opening vim
from root of your source file and extending path
option to include all sub-directories therein.
For example set path+=/usr/include/c++/**
for C++ headers and set path+=**
for your source directory.
This ,then, opens a plethora of following possibilities.
1) Opening file by name or parts of it
:find file_name
You can use auto-completion and wildcard expansion with :find
reliably. You type the name, it will locate the name. This works language agnostic.I am sure you will like it.
2) Navigating to files under cusror:
if you want to go a file path like #include "project/path/classA.h
.
gf or gF - go to file under cursor.
Ctrl-6 - to come back to last cursor position after gf
or gF
3) API lookup and navigating to the API location
[i
or [I
can be used to look up your function signature for word under cursor without leaving your workspace. [<Tab>
to actually go to declaration. Use Ctrl-6 to come back to last location.
Without extending path
, you can start navigating files by :Ex
command and navigate and open your file. I prefer NerdTree
over this though.
Exuberant ctags.
Use Ctrl-] to jump to the tag under the cursor.