I'm editing pandoc markdown text with inline math. Since that uses underscores, vim will helpfully highlight everything after the first underscore, but there will be no matching one. enter image description here

How can I turn off highlighting for this syntax element? In ~/.vim/syntax/markdown.vim I find elements like

syn region markdownItalic start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart
syn region markdownItalic start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart
syn region markdownBold start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic
syn region markdownBold start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart,markdownItalic
syn region markdownBoldItalic start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" keepend contains=markdownLineStart
syn region markdownBoldItalic start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart
syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart
syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart
syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*```.*$" end="^\s*```\ze\s*$" keepend

So I tried :hi clear markdownItalic and the same with markdownBold and markdownBoldItalic. None of those do the trick.


As you've discovered, markdownItalic is a link to htmlItalic, which just means the former uses the highlighting configured for the latter group.

You can remove a highlight link with a command like the following:

:highlight link markdownItalic NONE

See :help :highlight-link for more details.


It seems that the markdownItalic syntax element is a link to htmlItalic (could someone elaborate what that means?), so setting hi clear htmlItalic does the trick for me. The downside is that this breaks all other sort of highlighting within the region vim thinks is italic text.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.