merlin2011
merlin2011

Reputation: 75565

How do I find out which syntax command causes a particular word to be highlighted in vim?

When I open a .c file in vim, and I type TODO inside a comment, it gets highlighted with yellow in vim. Note that this is not specified in my own .vimrc.

However, when I open a .r file, and I use TODO inside a comment, it does not get highlighted. I am trying to figure out how to make it so that TODO gets highlighted in R file as well, but I am not sure how to find the command that highlights TODO in .c files.

Upvotes: 1

Views: 94

Answers (2)

romainl
romainl

Reputation: 196556

The default R syntax script ($VIMRUNTIME/syntax/r.vim) links rOKeyword, TODO's syntax group, to the Title highlight group.

The default C syntax script ($VIMRUNTIME/syntax/c.vim) links cTodo, TODO's syntax group, to the Todo highlight group.

TODO is not highlighted in R files as in C files because it is not linked to the right highlight group.

I suggest you contact the maintainer and ask him to fix that issue.

Upvotes: 3

mike3996
mike3996

Reputation: 17517

I wonder if this helps?

VIM: How can i know which highlight rule is being used for a keyword?

Examine the troubling highlight classes, do a grep or ack by the names in the .vim files under /syntax/ directories.

Upvotes: 1

Related Questions