I understand that it may be too late, but I hope that it would be useful for someone.
We have a relatively large project for working about a thousand files of C / C ++ code, php and shell scripts, configs, and more.
To navigate through the files, I use the following options.
First , I use a simple grep wrapper stored in my .vimrc to find a specific line in the files:
function MyGrep( pattern, path, case, whole ) execute "normal! GoSearch text " . a:pattern . " in " . a:path . " and subdirs, case: " .a:case. " whole: ".a:whole "E - extended regexp, l - display filenames only, r - search recursively let l:keys = "Elr" if a:case == 0 "case-sensitive let l:keys = l:keys . "i" endif if a:whole != 0 "whole words only let l:keys = l:keys . "w" endif let l:cmd = "r!grep -" . keys . " -e \"" . a:pattern ."\" " let l:cmd2 = a:path . " --exclude=*.ncb --exclude=*.o --exclude=*.d --exclude-dir=.svn --exclude-dir=.d --exclude-dir=rc.d --binary-files=without-match" echo l:cmd . l:cmd2 execute l:cmd . l:cmd2 endfunction com -nargs=1 GrepHere call MyGrep( <q-args>, "./", 0, 0) com -nargs=1 GrepHereCaseWhole call MyGrep( <q-args>, "./", 1, 1) com -nargs=1 GrepHereCase call MyGrep( <q-args>, "./", 1, 0) com -nargs=1 GrepHereWhole call MyGrep( <q-args>, "./", 0, 1)
In windows, I use vimgrep and changelist with this command (also in .vimrc ):
command -nargs=1 VGCodeHere :vimgrep /<args>/j ./**/*.{c,cpp,h,rc} | copen
Both greppers are dependent on the current working directory, so be sure to install it correctly. Usually I open a new unnamed tab in Vim and use the search commands here to dump the file names that interest me, search results, log locations and other information.
Second , the cscope utility and the Vim plugin are a very convenient way to view files, functions, symbols in a project, but if you are dealing with C / C ++ sources.
Third , Vim's own tricks, such as
:e ./**/filename.cpp to open the file filename.cpp somewhere in the subtree of the file system. Support for <Tab> file name completion.:tabe %<.h to open the corresponding header file (you can change the .h extension to whatever you like):Ex for navigation using the built-in file system browser- Ctrl-O, Ctrl-I to go back and forth to the Vim jump list.
And to resume the next time from the same Vim state, I use sessions . Save the session in Vim with :mksession sessionname.vis , and start vim with the session: vim -S sessionname.vis