There are dozens of good vim cheat sheets online. Why do another one? This one is a cheat sheet tailored to my workflow for generating ctags. Let’s have a look.

Generate ctags like this (replace js with whatever language files you want to ignore, if any. I don’t code javascript, but my projects contain tons of js files, so I exclude them):

ctags -R -f ~/.ctags --exclude='*.js' <path-to-project>

If your project contains a language that is not supported by ctags, but is related to another familiar language, you can use langmap. In my example I map groovy files to java. Groovy is a superset of java, so this works: ctags -R -f ~/.ctags-groovy --exclude='*.js' --langmap=java:.groovy <path-to-project>

The result of these two commands are two ctags files. Reference them in your .vimrc and you’re set.

Add the following statements to ~/.vimrc.

set tags=~/.ctags
set tags+=~/.ctags-groovy

refresh the .vimrc by opening it (vim ~/.vimrc) and executing the following command in vim: :so %