Monday, December 01, 2008

VxL code browsing in ViM

When working with a huge codebase, its nice to be able to browse
through the code lying in different directories.
Most other sites about ctags only deal with files in the same
directory, though.
I use vxl.sf.net, which consists of a huge source tree of C++
libraries, headers, and templates.
Here is my solution:

I installed exuberant-ctags (make sure this is the one in your system),

then I issued the following command:

ctags -R vxl lemsvxlsrc

from the directory containing the vxl source tree 'vxl' and the
internal Brown 'lemsvxlsrc' tree.
This generates a tags file. Now, tell VIM to always use that by
setting a tags search path:


" Set the tag file search order
set tags=./tags,tags,~/tags,/home/rfabbri/cprg/vxlprg/tags

You can add the above line to your ~/.vimrc or, even better, to a file
in ~/.vim/ftplugins/cpp_xxx.vim, where xxx is a custom extension you
choose.

2 comments:

rfabbri said...

You can also add the following to your ~/.ctags configuration file:

--langmap=C++:+.txx

so that vxl templates can be scanned.

rfabbri said...

For C++11 and up use universal-ctags

On Macs:

brew install universal-ctags

It will catch tags defined in with constructions such as using