iago-lito
iago-lito

Reputation: 3218

Vim doesn't highlight some words

I'm using the TagHighlight plugin in Vim to get highlighting of my custom C++ classes and members.

This trick I found there allowed me to better understand how Vim considered certain words. In a way I can ask it now: "Okay, why have you put this word in green?"

The strange thing is that it works well, except for (many) random cases, see:

enter image description here

My library's namespace sf has been highlighted, and Vim tells hi<CTagsNamespace> trans<CTagsNamespace> lo<Constant> when I ask it why, great.

But the std hasn't, and the answer is hi<> trans<cParen> lo<>.

My variable angle has been spotted as a hi<CTagsMember> trans<CTagsMember> lo<Member> (why not?), but its little bro' speed hasn't: it is hi<> trans<cBlock> lo<>.

So.. why? Is there a way Vim can actually read and understand my whole project, then highlight it the proper way?

Upvotes: 0

Views: 462

Answers (1)

mMontu
mMontu

Reputation: 9273

From TagHighlight 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.

You probably doesn't have the source for the std namespace, therefore no tags and thus no highlight.

Your ctags probably is not generating tags for local variables, thus speed gets no highlight. But you probably has a variable named angles as global or member variable, thus the local variable angle gets highlighted by accident.

And don't blame Vim, this is probably something to do about the plugin and your tags :)

Upvotes: 1

Related Questions