vim tags

Author: yifei / Created: May 30, 2017, 9:03 p.m. / Modified: May 30, 2017, 9:06 p.m. / Edit

To use go to definition and other advanced IDE feature, we need to generate tag files for vim to figure out where to find the functions or variables.

To generate a tag file

ctags -R

By default, the generate tag file will be located at ./tags directory, we need to let vim know where to find it by:

:set tags+=tags

To search for a symbol in vim, use

:tag [symbol-name]
:tag /[search-name]

To go to the definition, we need Ctrl-], to go back, press Ctrl-t

:tn next tag
:tp prev tag
:ts all tags



vim tags matchlist is not very user friendly. I should write my own that shows the list in quick fix window