Search code examples
c++11vimenumsexuberant-ctags

Does exuberant ctags support c++11?


I like having my syntax highligthed in vim through the TagHighlight plugin, which uses exuberant ctags to generate a tags file that vim uses for syntax.

Until recently, I was just using regular enum types such as

enum count {ONE, TWO, THREE};

which was getting tagged correctly. My group recently decided to support c++11, and I tried

enum class count {ONE, TWO, THREE};

The enum "count" is now tagged as a class instead of enum, "ONE" and "TWO" are marked as class members and "THREE" is not tagged at all.

I tried to use --regex-c++=/^[ \t]*(enum)[ \t]+(class)[ \t]+([a-zA-Z0-9_]+)/\3/e,enum/ as a regular expression, but was unsuccessful. It seems the enum class should be a standard type to generate ctags from, but haven't found anyone complaining about it. Am I stupidly overlooking something simple?

ctags-exuberant --version Exuberant Ctags 5.9~svn20110310, Copyright (C) 1996-2009 Darren Hiebert Compiled: Sep 29 2014, 16:06:25 Addresses: <[email protected]>, http://ctags.sourceforge.net Optional compiled features: +wildcards, +regex

An alternative approach to custom syntax highlighting in vim would also be appreciated.


Solution

  • There is a more up to date version of exuberant ctags called universal ctags available here. It has support for C++11 along with many more languages compared to exuberant ctags (the full list is here). If you're on mac you can install with homebrew using

    brew tap universal-ctags/universal-ctags
    brew install --HEAD universal-ctags
    

    Universal ctags is just a fork of exuberant ctags and should be usable as a complete replacement for it.