Monday, January 10, 2011

Ctags in UNIX

If you want to traverse code efficiently from one function to other in UNIX,then there is one awesome solution. It is called CTAGS.

  • Code can be of any language like perl,c,c++,LISP,etc.
  • e.g. following are the steps to create it for a directory that contains all the files for which you want to create tags. Let's say there is directory "y" somehere in UNIX file system which contains all files.


------------------------------------------------------------------------------------------------
2.

---------------------------------------------------------------------------------------------

3.

this is tht ctags command that creats tags file as you can see in above image.
This tags file contains all tags of functions those are present in the differnt files.

-------------------------------------------------------------------------------------------
4.

As sshown in above image go to ~ directory and create .vimrc file as shown above.
This file might be already present.


----------------------------------------------------------------------------------------------

5.



after editing .vimrc, just add as shown above.
save and exit

--------------------------------------------------------------------------------------------

6. You are done. Goto any file under "y" directory (your directory may be diffrnt).
Once your cursor is on any function in that file whose defination is in some other file,
press esc , then ctrl + ] to jump to that file which contains defination.
press esc , ctrl + o to jump back.


In this way you can traverse complete code very efficiently by jumping from one function call to other function call.

If you have any query about this please email me kuldeeprock@gmail.com.
I promise you to reply within 12 hours.
Thank you

No comments:

Post a Comment