Fix YAML syntax highlighting in VIM

5

1

The YAML syntax highlighting in Vim 7.3 isn't great. Putting an apostrophe in a line of text triggers quote highlighting even when there's no quote. The same thing happens in other files sometimes too. I've posted a screenshot below. Is there any way to fix this behavior, or is there a different YAML syntax file I can use that won't trigger this behavior? This occurs in both MacVim and Vim in the Terminal. I'm running v7.3.

Thanks for your help, Kevin

attached a

Kevin Burke

Posted 2011-01-24T01:47:15.163

Reputation: 809

Answers

3

look at your vim7.3 installation directory under syntax/yaml.vim, roughly line 32:

syn region  yamlString      matchgroup=yamlStringDelimiter
                            \ start=+'+ skip=+''+ end=+'+
                            \ contains=yamlSingleEscape

if you throw that out, vim wont try to guess that ' is not the start of a string. the only other way imho would be to change the code so a ' only count as the start of a string, if the preceding character is a whitespace... but if you dont use ' as string-quote anyway, just throw out what i mentioned.

akira

Posted 2011-01-24T01:47:15.163

Reputation: 52 754

for VIM 7.4 you want to find two lines that start with syn region yamlFlowString and comment them out. – Marcin – 2016-08-22T17:25:36.883