Customize Taglist Plugin Display
I’ve hopped back on the VIM train recently, and I’m loving it. Command-T, NERDTree, buffer explorer and fixing my fonts in MacVIM ( set guifont=Inconsolata:h16 ) have all been essential to the move. That and the INSANELY helpful folks in #vim on freenode.
I just read the VIM book cover to cover. Extremely useful. I recommend it.
The latest thing I figured out I wanted was to make better use of ctags. I’ve gotten used to a bunch of the completion commands, now I’m looking to browse my code better.
Enter Taglist.
Taglist is the most downloaded script on vim.org. It’s awesome. And I finally figured out the only thing that’s been bugging me about it - how to only show my classes and functions in a file, ignoring variable names. There were just too many.
Here’s the important part of the help file I found:
In the above setting, ‘cpp’ is the Vim filetype name and ‘c++’ is the name used by the exuberant ctags tool. ‘c’ and ‘f’ are the flags passed to exuberant ctags to list C++ classes and functions and ‘class’ is the title used for the class tags and ‘function’ is the title used for the function tags in the taglist window.
For example, to display only functions defined in a C file and to use “My Functions” as the title for the function tags, use
let tlist_c_settings = 'c;f:My Functions'
When you set the tlist_xxx_settings variable, you will override the default setting used by the taglist plugin for the ‘xxx’ language.
So I did this:
let tlist_php_settings = 'php;c:class;f:function'
and when I restarted vim, I only saw my classes and my functions. It’s awesome.
If you found this post helpful, please consider sharing to your network. I'm also available to help you be successful with your distributed systems! Please reach out if you're interested in working with me, and I'll be happy to schedule a free one-hour consultation.