vim 中生成和使用 tags

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


多年大厂求职&面试官经验,简历付费优化,¥ 500/次。


About 逸飞



邮箱地址不会被公开。 必填项已用*标注