sponsor Vim development Vim logo Vim Book Ad

TagHighlight : Extra highlighting of typedefs, enumerations etc (based on ctags)

 script karma  Rating 270/106, Downloaded by 14645  Comments, bugs, improvements  Vim wiki

created by
Al Budden
 
script type
ftplugin
 
description
TagHighlight is a plugin that highlights names of classes, variables, types etc in source code in Vim.  This makes it quicker and easier to spot errors in your code.  By using exuberant ctags and parsing the output, the typedefs, #defines, enumerated names etc are all clearly highlighted in different colours.  As standard, it supports the following languages (but it's very easy to add more):

* C/C++ (most of the testing has been with these)
* C#
* Java
* Javascript
* Matlab (if your version of ctags supports it)
* Perl
* PHP
* Python
* Ruby
* Scala
* Fortran
* Go (if your version of ctags supports it)
* VHDL (if your version of ctags supports it)

Adding more languages is extremely simple.

To show the benefit of this plugin, there are some screenshots and a more detailed description at the following website:

http://www.cgtk.co.uk/taghighlight

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

This version replaces the previous "CTAGS Highlighting" script and it is necessary to uninstall that plugin in order to upgrade to the new version.  Detailed instructions are on the website or in the enclosed documentation.

The source is now maintained on heptapod (https://heptapod.host/cgtk/taghighlight).  There is also a mirror on github (https://github.com/abudden/taghighlight-automirror), although I can't guarantee this will be as up to date as the heptapod version.
 
install details
Uses python 2.6+ (including 3.0+), but if you don't have python, there is a compiled (for Windows or Linux) version of that part of the plugin available on the website:

http://www.cgtk.co.uk/taghighlight

It also requires a few extra highlighting groups to be defined (using :highlight).  See the documentation for details.  Alternatively, install the Bandit colour scheme from vimscript #2645 (or http://www.cgtk.co.uk/bandit): this provides all the groups by default.  You can easily customise this if you don't like the colours.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
taghighlight_r2.1.4.zip 2.1.4 2011-12-15 7.0 Al Budden 2.1.4 changes: Added support for Go Programming Language (thanks to Ali Hamdi) and improved internal modeline to make adding new languages easier.

2.1.3 changes (not uploaded to this site): Fix to make TagHighlight work with pre-7.3-288 versions of Vim (bug in has() function).  Added support for Fortran (thanks to Oleg Lebedev).
taghighlight_r2.1.2.zip 2.1.2 2011-08-30 7.0 Al Budden Allow overriding the file-language relationship without having to edit the language definitions.  Added support for Matlab (if your version of ctags supports it).  Added support for .hh extension for C/C++ headers.  Fixed bug with highlight priority for non-specified types.
taghighlight_r2.1.1.zip 2.1.1 2011-08-23 7.0 Al Budden Addition of LanguageDetectionMethods option to allow loading of types when FileType or Syntax are set (thanks to Hong Xu for the suggestion).  This also involved addition of syntax and filetype definitions to all languages.  Prevent Vim from repeatedly loading autocmds in plugin development mode.  Don't overwrite Cursor colour definitions with SQL cursor colouring (thanks again to Hong Xu for reporting this bug).
taghighlight_r2.1.0.zip 2.1.0 2011-08-22 7.0 Al Budden This is a replacement for the previous "ctags_highlighter" script that I wrote a while ago, with quite a few changes/improvements:

* Now works well even if you don't keep the current directory at the root of your project;
* Recursive by default (rather than with '!' on command);
* Works with any recent python (2.6+, 3.0+), with or without the Vim python interface; alternatively a binary version is available for Linux or Windows if you don't have a recent version of python installed;
* MUCH more customisable and project options are easier to set;
* Better standard library support (e.g. highlight of tag names for Qt4, JDK, Android, wxWidgets etc) with a separate download from the (new)  website - much easier to create new standard libraries;
* Support for user libraries (highlighting of tag names for your own library
* Much easier to add support for new programming languages - all defined with a single text file (assuming ctags supports the language);
* Uses Vim's autoload mechanism, so should be quicker to load;
* Uses a dictionary for settings, so less namespace clutter;
* Support for pre- and post- update and read hooks in case you really want to do something clever;
* New website (http://www.cgtk.co.uk/taghighlight)

This is the first release of the new version.  I would like to extend my gratitude to Aleksey Baibarin, Marcus Martin, Mishail, Prasun Ratn and Yongwei Wu for their help testing all the various pre-releases of the new version.  Without their help, there would be a LOT more bugs in this version than there are now!
ctags_highlighting.vba r458 2011-04-07 7.0 Al Budden Inclusion of vim keywords controlled by separate option.
ctags_highlighting.vba r456 2011-04-06 7.0 Al Budden Fixed accidental change of line-endings.
ctags_highlighting.vba r454 2011-04-06 7.0 Al Budden Fixed accidental change of file-type.
ctags_highlighting.vba r452 2011-04-06 7.0 Al Budden Better handling of unknown ctags tag kinds.
ctags_highlighting.vba r443 2011-02-22 7.0 Al Budden Allow customisation of the filenames used for tags and types files (thanks to Sung Pae).
ctags_highlighting.vba r442 2011-02-16 7.0 Al Budden Improved type prioritisation for object-oriented languages.
ctags_highlighting.vba r440 2011-02-16 7.0 Al Budden Added better support for different C++ extensions and to avoid conflicts with C# files.
ctags_highlighting.vba r435 2011-01-12 7.0 Al Budden Changed default to not include syntax matches unless either g:TypesFileIncludeSynMatches or b:TypesFileIncludeSynMatches is set to 1 (this makes the highlighting much faster for large projects).
ctags_highlighting.vba r431 2010-12-03 7.0 Al Budden Better support for paths with spaces in them.  Added support for Android SDK and Java JDK (requires latest gui_types_and_tags from the website).  Optional local variable highlighting (see caveats on the website) for Java, C# and C++ as well as C.
ctags_highlighting.vba r398 2010-03-30 7.0 Al Budden Added support for ctags 'import' type in python.
ctags_highlighting.vba r396 2010-03-29 7.0 Al Budden Significantly improved support for languages other than C.  Factored out redundant ctags_* intermediate highlight groups.
ctags_highlighting.vba r391 2010-03-03 7.0 Al Budden Better support for different languages including support for C# (thanks to Aleksey Baibarin).
ctags_highlighting.vba 387 2010-02-19 7.0 Al Budden Fixed bug in new vimfiles location operation.
ctags_highlighting.vba r384 2010-02-19 7.0 Al Budden Improvements to VIMFILESDIR identification.  Re-architecture of type definitions to make them more sensitive to different ctags "kinds" for different languages.  Note that Enumerator has been renamed to EnumerationValue: the latest Bandit Colour Scheme supports this.  Fixed escaping of paths and operation of ReadTypes when not in an autocommand.
ctags_highlighting.vba r340 2009-11-02 7.0 Al Budden Added missing winrestview() call (thanks to Yongwei Wu for reporting this).
ctags_highlighting.vba r309 2009-08-18 7.0 Al Budden Added experimental PHP support and a lot more documentation.
ctags_highlighting.vba r301 2009-08-07 7.0 Al Budden Added shellescape() to GUI types and tags files and moved them out of the main distribution (see update 7th August 2009 on the website).
ctags_highlighting.vba r292 2009-08-03 7.0 Al Budden Fixed bug with (optional) cscope database generation.
ctags_highlighting.vba r286 2009-07-27 7.0 Al Budden Fix for Linux spaced paths (Mikhail Stepura).
ctags_highlighting.vba r285 2009-07-27 7.0 Al Budden Added support for ctags being stored in a path with spaces and other odd characters (thanks to Mikhail Stepura).
ctags_highlighting.vba r262 2009-05-23 7.0 Al Budden Changed some of the defaults to the python script (so fewer options need to be passed by UpdateTypesFile).  It should now be possible to generate the types file simply by running "mktypes.py" or "mktypes.py -r" in the project directory.  Of course, UpdateTypesFile still works too.  Added UpdateTypesFileOnly command for projects in which the tags file is updated externally (e.g. the Linux kernel source).  Removed regular expression matches by default: this is much quicker for large projects.  Also added more screenshots to the website.
ctags_highlighting.vba r233 2009-05-21 7.0 Al Budden Initial upload
ip used for rating: 44.220.184.63

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github