1

I am using vim-markdown and I want to conceal the tags <u> and </u> of the following text:

Lorem ipsum dolor sit amet, <u>consectetur</u> adipiscing elit, sed do eiusmod tempor

How to do that?

I tried to add the following in after/syntax/markdown.vim, but with no success:

syntax match UTag "<u>" conceal
syntax match UTag "</u>" conceal
syntax region UText start="<u>" end="</u>" contains=NONE concealends cterm=underline gui=underline

1 Answer 1

0

You can take inspiration from $VIMRUNTIME/syntax/markdown.vim:

" inspired by markdownItalic
syntax region markdownUnderline
    \ matchgroup=htmlTagName
    \ start="<u>\S\@="
    \ end="\S\@<=<\/u>\|^$"
    \ contains=markdownLineStart,@Spell
    \ concealends

Note that cterm=underline and gui=underline have nothing to do in a syntax script. Instead, link your custom highlight group to a default group:

highlight def link markdownUnderline Underlined

See :help syntax and more specifically :help group-name.

With cursor on another line:

a

With cursor on the line with <u>…</u>:

b

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.