As nobody has given one critical function in these answers, I'll provide one more slightly superior answer.
The easiest way to use ctags with vim is by calling:
ctags -R *
from the root of your source repository. This will generate a tags
file in that same directory.
In your ~/.vimrc
file, add this short block:
" ctags optimization
set autochdir
set tags=tags;
"
denotes a comment. set autochdir
tells vim that if it doesn't find a tags
file in the $PWD
it will look in the directory parent for the tags
file, recursively. set tags=tags;
tells vim that the name of your tags
file will always be the same as the default tags
file generated by ctags.
So long as you run ctags -R *
in your root source directory the first time and occasionally to update it (if you pull new changes from others) then you'll always have a fast and intuitive ctags symbol lookup in vim.
-R
option - it's much more common to invoke ctags recursively on an entire directory structure than to run it on individual files. – Manizales