Friday, June 20, 2008

Ctags: whats it? N how to use it?

Sponsored Links
Well, whats the use of ctags. Ctags allows you to go to the function definition from function declaration even its not defined in same file. Suppose you have a program "add.c" and there is a function "calculate( )" in it. And "calculate( )" is defined some where else. If you have ctags you can go directly to definition by pointing the cursor to function and press "shift" + "]" . You can go back by pressing "ctrl" + "t".

First of all download this package, Exuberant Ctags. If you are using Debian you can get it from synaptic.

1.Open the terminal

2.Open the directory of the file[in this case dir where add.c resides. If in /home then cd home]

3.Type ctags -R on terminal or ctags -R[space]*

4.Open program add.c [as vi add.c]

5.Type :set tags=../../tags [if you run ctags -R outside the currrent directory, else just :set tags=./tags else :set tags=../tags as where you run "ctags -R"]

Its over.. enjoy..
Sponsored Links

No comments:

Post a Comment

Be nice. That's all.