Ghislain Rodrigues

Vim tags completion

Vim autocompletion is great (:help ins-completion), line and path completions are among my favourite. Vim also supports tags completion (CTRL-x CTRL-], to jump to tags definition (for example a class, method or function definition).

However, it needs a ctags file defined for it to work. Tim Pope described a very straightforward way to manage them using Git hooks along with templates, it becomes completely transparent and just works.

Once you have your ctags file ready, you can then set it up in your .vimrc with the following:

set tags+=/path/to/you/ctags/file

If you use Git hooks as described above, your line will probably be:

set tags+=.git/tags

From this point, pressing CTRL-x CTRL-] should open the autocompletion menu with the available tags.