sudo apt-get install ctagsGenerate tags file. To do this go to the main directory of your source tree. There just issue the command:
ctags -Rthis will recursively traverse the source directory and generate a tags file containing information about all symbols -functions and variable- in the source files.
Using Vim with ctags is straight forward. Vim has builtin support for ctags so now you just need to issue vim command from the directory where you generated the tags file using ctags.
vim src/asdf/test.cNow in the file move a cursor to some function or variable and press Ctrl-]. This will take you to the definition of that function or variable. To go back to where you came from press Ctrl-T, this will take you back to where your were before pressing Ctrl-]
If you have more than one tags files or you dont want to always use vim from one directory then add following line to your .vimrc file in your home directory:
set tags=tags;/
No comments:
Post a Comment