If you’re a programmer, you might be interested in taking advantage of the ctags utility to quickly navigate through your source code in a text editor such as VIM.
Ctags is a utility or program that creates an index (aka tag) file of names found in source and header files of various programming languages. This index includes things such as functions, variables, class members, macros, etc. This is great because vim can take advantage of this index and you can more quickly navigate through source files. For more information, wikipedia has a nice article on it here.
To start using ctags, you must first have the ctags utility. A quick check would be to just type
ctags --version in the terminal:
[email protected]> ctags --version ctags (GNU Emacs 23.1) Copyright (C) 2009 Free Software Foundation, Inc. This program is distributed under the terms in ETAGS.README
If you have it, then we can immediately start using it. First, build the index by running in the directory where you keep the source code:
If you’d like to be able to recursively scan all of your source files, you must insure that you’re using the exuberant ctags utility. In a Debian based system, this is simply done with:
sudo apt-get install exuberant-ctags sudo update-alternatives –config ctags
Then, open the source in vim and use ctrl ] to jump into the tag and ctrl t to jump out of the tag.
There’s quite a bit of information available out there on using these tools together. I would recommend taking a look around. Here are a few that I found:
Stackoverflow: Vim and Ctags tips and tricks
Linux.byexamples: Vim with Ctags