EasyTags plugin for Vim

EasyTags is a fantastic plugin for Vim. It achieves two objectives that are related to each other: automatically index your source code and enhance the syntax highlighting of your source code. These two tasks are related because improving the syntax highlighting of code requires knowledge of what every word means in your code, which is what the tags provide. This adds another IDE-like feature to Vim.



  • This plugin automatically generates tags for the currently open files using the ctags tool. This is written to ~/.vimtags. The tags are generated automatically when you do not move the cursor for a few milliseconds. Vim generates the CursorHold when you pause typing and EasyTags uses this to do its work. Note that the tags are generated even if your file is not yet saved, since EasyTags is using the buffer, not the file.

  • This plugin also automatically highlights the tags it has indexed. Vim can only highlight the keywords of a language, not the new types or functions you define in it. EasyTags uses the index it has generated and highlights all the tags. So, you should see a lot more of your code in colors.

  • This plugin can be configured to read and update the tags file of your project, instead of using ~/.vimtags. To do this, your Vim should be configured to walk back the directory hierarchy to pick the first tags file it can find. Then EasyTags can be requested to use this tags file for updating, if it is found. I achieve this by adding these two lines to .vimrc:

" Let Vim walk up directory hierarchy from CWD to root looking for tags file
set tags=tags;/
" Tell EasyTags to use the tags file found by Vim
let g:easytags_dynamic_files = 1
  • To generate tags only when a file is saved, add this to .vimrc:
let g:easytags_events = ['BufWritePost']
  • To disable automatic highlighting of tags, add this to .vimrc:
let g:easytags_auto_highlight = 0
  • To explicitly ask EasyTags to index files, use the command :UpdateTags

  • To explicitly ask EasyTags to highlight tags, use the command :HighlightTags

Tried with: Vim 7.4 and Ubuntu 14.04

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.