I have the following in my ~/vim/syntax/xrc.vim to spell check contents of specific tags when editing XRC files that are just XML files with predefined schema:

runtime syntax/xml.vim

" check spelling for the user-visible strings.
syn region xrcString matchgroup=xmlTagName start="<\z(label\|text\|tooltip\|value\)>" end="</\z1>" contains=xmlEntity,@Spell

" and also highlight them as such.
hi link xrcString xmlString

and it works without problems -- as long as I don't also try doing let g:xml_syntax_folding=1.

If I enable syntax folding for XML, my region definition is not taken into account any longer (at least not with Vim 8.2). It seems to be due to the different xmlRegion definition in this case in Vim own syntax/xml.vim, but I'm not really sure.

Ideally I'd like to have both folding and spell checking for my tags. Does anybody know how to do this?

  • 1
    It looks like xmlRegion is only defined when g:xml_syntax_folding and this prevents matching of your syntax group. Please open an issue at the upstream repository github.com/chrisbra/vim-xml-runtime Apr 24, 2020 at 19:23
  • 2
    BTW: I cannot reproduce this with the latest runtime files from there Apr 24, 2020 at 19:38
  • Thanks Christian, I'll try to recheck this with the latest version from there, sorry for not thinking to do it before asking.
    – VZ.
    Apr 24, 2020 at 23:18
  • Sorry for the much longer than planned delay, but I finally rechecked this with the latest version and I don't think it changes anything, so I've opened this issue. Thanks again!
    – VZ.
    May 8, 2020 at 0:29
  • 1
    will have a look soon May 8, 2020 at 5:57


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.