Monday, June 20, 2005

ctags and some vim stuff

If you are editing a C program using vim, then create a tag file using ctags

:!ctags . [ . for the current file ] OR :!ctags * [ * for all the .c and .h files, if you are in a src directory]

Now, the next time you stumble across a function name,variable name and you want to know its declaration, then just do a CNRL + ]. Thats it! Quite useful.

Another feature of Vim is Auto-completion. for example#include<expat.h> has number of XML related declarations typing the first few characters of variable and then doing CNTL+Nshould provide you list for the auto-completion. Interesting, huh?