As you might know, I'm used to code in Java in Eclipse. As many other modern IDE users, I'm not really used to code using a text editor. Yesterday evening, in my hotel room, I was idling among the OpenOffice.org sources and I was really impressed by what can be done with Vim and ctags.

Building the tags file

I have installed ctags-exuberant and here is the command line that I have used to build my tags file:

ctags --recurse=yes --languages=C,C++,Java,Python --totals=yes  --fields=fksiSm --exclude=unxlngi6\.pro

The surprise for me was the time it takes for ctags to build the tags file for the whole OpenOffice sources. Here are the output statistics:

31490 files, 10738178 lines (352871 kB) scanned in 35.8 seconds (9865 kB/s)
772019 tags added to tag file
772019 tags sorted in 0.00 seconds

Using the tags in Vim

After this really good surprise I really wanted to try this discovery. Thus I opened Vim and read the help on the tags features. Here are some of the interesting commands:

  • :ta \<ident> shows all the places where the identifier pattern matches
  • Ctrl + ] opens the definition of the identifier under the cursor
  • Ctrl + T comes back in the tag navigation history

Using these commands I have finally found out what is the SAL_CALL macro... this is nothing for most of the platforms but has its importance for MSC (__cdecl). Using these commands I don't need to remember where exactly a type is defined or or implemented: Vim is remembering it for me!