Vim syntax highlighting: how to stop the automatic underlining of <a href=..>?

7

1

When I type a HTML element a, there is always a underline. I want to stop this, but do not know how?

I'm talking about the vim syntax highlight.

Jichao

Posted 2010-09-30T15:37:06.977

Reputation: 5 245

1Are you talking about syntax highlighting in vim or styling html? – Benjamin Bannier – 2010-09-30T15:50:33.277

Isn't it also clickable in Vim, to open the link in a browser? (Hence: maybe it's not just about how it's displayed?) – Arjan – 2010-09-30T17:13:51.663

@Arjan: vim's syntax highlighting displays the anchor text (content of the <a> tag) in underline. – user1686 – 2010-09-30T19:24:33.283

Answers

5

Make a copy of the html.vim syntax highlighting definition.

mkdir -p ~/.vim/syntax
cp /usr/share/vim/vim73/syntax/html.vim ~/.vim/syntax/
# "vim72" for version 7.2
vim ~/.vim/syntax/html.vim

Find this line: (should be around line 248)

    HtmlHiLink htmlLink                    Underlined

To disable styling completely, comment out the line (prefix with a " double-quote).

To change appearance, replace the Underlined part with a different highlight definition (such as htmlBold, or define your own: there are several examples just below that line).

user1686

Posted 2010-09-30T15:37:06.977

Reputation: 283 655

8Or better yet, just put something like "highlight link htmlLink text" in: ~/.vim/after/syntax/html.vim -- that way you won't have to worry about what happens when a new version of the default html.vim comes out. – Heptite – 2011-09-06T16:59:58.150