top of page

Install ctags, Create tags, Browse in Vim

Updated: May 14, 2023


This post presents how to install ctags on Ubuntu 16.04.3, create tags and browse the code in vim.


Install

Type sudo apt-get install ctags


Note: this command will actually install exuberant-ctags on Ubuntu 16.04.3. Here's the output


Create tags File

1. cd into the directory of code

2. Type ctags -R .


Browse Code

1. Open a .c, .h or .cpp file with vim

2. Put your cursor on a symbol

3. Type <C-]> to jump to a symbol. Keep typing to build a stack of symbols.

4. Type <C-t> to jump back. Pop back to where you last were. Works until the stack of symbols is exhausted.


References

  • Vim and Ctags by Andrew Stewart at [link]

  • The Vim logo is from [link]


Additional Info


What is are ctags? (asked on Reddit at [link])


From: http://ctags.sourceforge.net/whatis.html ctags is the program that generates an index also called tags. These tags are "language objects found in source files that allows these items to be quickly and easily located by a text editor or other utility. A tag signifies a language object for which an index entry is available (or, alternatively, the index entry created for that object)."

bottom of page