Dylan Harness
Dylan Harness

Reputation: 729

How to override specific syntax rules for XML in vim?

In vim my html has end-tags highlighted the same as start tags, my XML does not:

I understand this is a problem with the theme I'm using which is this:

https://github.com/flazz/vim-colorschemes/blob/master/colors/codeschool.vim

But I'm not sure how to go about tracking down what to change, and where to override it. I would like the end tags to match the start tags.

Upvotes: 2

Views: 213

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172608

You need to find out which syntax group causes the highlighting. :syn list shows all active groups, but it's easier when you install the SyntaxAttr.vim - Show syntax highlighting attributes of character under cursor plugin. When you have the name of the offending syntax group, you can investigate where it comes from; (the last lines of) :scriptnames may help.

In XML, the start tag is highlighted by xmlTag and xmlTagName, whereas the end tag is highlighted by xmlEndTag. Usually, all three are linked to the built-in Identifier highlight group. You can investigate where this got changed via:

:verbose hi xmlEndTag
xmlEndTag      xxx links to Identifier
    Last set from /usr/local/share/vim/vim80/syntax/xml.vim

Upvotes: 1

Related Questions