Monday, June 23, 2008

Using Vim + ctags for easy locating of "#define" variables

If you want to find where some variable is defined in C code, you can use:
Ctrl-]


in Vim editor. However, this does not work for "#define" variables until you execute:
ctags *.h *.c


on all .c and .h files that you want to tag. After that you can search for "#define" variable using Vim's Ctrl-] command. In order to return at the original position (before the search) press Ctrl-T.

No comments: