Linux.com

Home Linux Community Community Blogs General Linux ctags utility - to edit/see source files in vi/vim

ctags utility - to edit/see source files in vi/vim

Dear All,

Gonna tell you about the ctags utility and how to use it in your project.
I am taking the example on Ubuntu 10.10 for C++ project

Step 1. Install ctags tool via Synaptic Manager

Step 2. To know which languages does ctags support fire the below command
ctags --list-languages --list-type
it will give you the whole list of languages for whcih cross refernce for variables, subroutines/functions etc. available use it accordingly vi/vim supports everything.

step 3. In the source directory where your Definition/Declaration files are present:

run the following command
ctags *.cpp *.h or ctags -R ( it wil recursivley generate the tag file)
you can name your own tag file  with the option -f or -o otherwise default tag file named tags would be generated.

step 4. now open any  source file  in vi / vim editor and  go to the Ex. mode(:)
type the command 'tag functionname' (the name of the function whose definition you want to look for) short form ( : ta functionname) right after this command you will be taken to the file containing the definition of the functionname there you can make the changes or go thru the definition save it (:w) or use :set autowrite feature . type : ctrl+ l or ctrl +o to come back to the original file.

for more info read man ctags:
please comment / suggest cheers!!!!!!!!!!!11enjoy:)))))))))))

 

Comments

Subscribe to Comments Feed

Upcoming Linux Foundation Courses

  1. LFD312 Developing Applications For Linux
    05 Jan » 09 Jan - Virtual
    Details
  2. LFS220 Linux System Administration
    05 Jan » 08 Jan - Virtual
    Details
  3. LFD331 Developing Linux Device Drivers
    12 Jan » 16 Jan - Virtual
    Details

View All Upcoming Courses


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board