ynimous
ynimous

Reputation: 5162

vim highlighting: remove syntax keyword

One of the vim plugins I use does:

syn keyword rustTodo contained TODO FIXME XXX NB NOTE

Resulting in highlighting NB in comments, which I don't like. Is there a way to either redefine the keywords or remove one from them? Looking at :help syn-keyword makes me think that this is not possible.

Upvotes: 8

Views: 1907

Answers (2)

H. Weirauch
H. Weirauch

Reputation: 33

I had a similar question while importing syntax files from within other syntax files, and came up with a dirty hack.

Instead of loading your syntax file with

syn include @othersyntax syntax/othersyntax.vim

you can use

syn include @othersyntax !sed 's/<NB>//' syntax/othersyntax.vim

Eww. This brings serious platform dependency and security issues, but at least relieves you of the burden to keep the replacement keyword list in sync with upstream.

Upvotes: 0

Ingo Karkat
Ingo Karkat

Reputation: 172738

If that is the only definition for rustTodo (these are cummulative), you can remove and then redefine it:

syn clear rustTodo
syn keyword rustTodo contained TODO FIXME XXX NOTE

Unfortunately, the granularity for removal of syntax items is limited to whole syntax groups (here : rustTodo); you cannot pick individual keywords unless they also have separate groups (which would result in much more linking of highlight groups and therefore inefficient).

To make this permanent, put it into ~/.vim/after/syntax/rust.vim

If you think that the majority of users doesn't like NB here, please suggest to the author to drop it. Adding it back as a personal customization is easier and more maintainable than removing it...

Upvotes: 10

Related Questions