简体   繁体   中英

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:

在此处输入图片说明

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?

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 :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM