简体   繁体   English

如何在vim中覆盖XML的特定语法规则?

[英]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: 在vim中我的html的结束标记突出显示与开始标记相同,我的XML不会:

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 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. 我希望结束标记与开始标记匹配。

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. :syn list显示所有活动组,但是在安装SyntaxAttr.vim时更容易- 在光标插件下显示语法突出显示字符属性 When you have the name of the offending syntax group, you can investigate where it comes from; 当您拥有违规语法组的名称时,您可以调查其来源; (the last lines of) :scriptnames may help. (最后一行) :scriptnames可能有所帮助。

In XML, the start tag is highlighted by xmlTag and xmlTagName , whereas the end tag is highlighted by xmlEndTag . 在XML中,开始标记由xmlTagxmlTagName突出显示,而结束标记由xmlEndTag突出显示。 Usually, all three are linked to the built-in Identifier highlight group. 通常,这三个都链接到内置的Identifier高亮组。 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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