Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is vim drawing underlines on the place of tabs and how to avoid this?

Tags:

vim

underline

Without any specific regularity my vim displays underlines on the place of tabs (see below).

Sometimes it also happens to the text: I type and it's underlined.

What could be a reason?

enter image description here

like image 996
lyuba Avatar asked Jan 07 '11 12:01

lyuba


3 Answers

This is likely due to the fact that you are editing an html file and the text near the underline is inside of an <a> tag.

To disable this you can add let html_no_rendering=1 to your ~/.vimrc. This setting will, however, also disable bold and italic styling for html files.

If you wish to only disable the underlining, see :help html.vim. There it gives you instructions on what highlight groups you need to redefine without underline.

like image 112
Randy Morris Avatar answered Sep 22 '22 21:09

Randy Morris


This method (cobbled from other responses) will enable underline only under the text portion of the link without modifying the full html.vim syntax file.

  1. Create the file ~/.vim/after/syntax/html.vim
  2. Paste the following into that file:

    " disable the current htmlLink syntax
    highlight link htmlLink text
    
    " enable a new htmlLink syntax
    syn region htmlLink start="<a\>\_[^>]*\<href\>" end="</a>"me=e-4 keepend contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLinkText,javaScript,@htmlPreproc
    syn match htmlLinkText contained contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLinkText,javaScript,@htmlPreproc "^\s*\zs.\{-}\ze\s*$"
    syn match htmlLinkText contained contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLinkText,javaScript,@htmlPreproc "\S.\{-}\ze\s*$"
    
    " enable the new syntax
    hi def link htmlLinkText                Underlined
    
like image 31
zerotao Avatar answered Sep 24 '22 21:09

zerotao


It's probably one of two things, either:

  • You have 'list' set: (try :set list? and if this says list, try :set nolist)
  • You have some syntax highlighting configuration that highlights tabs as underlined. Add the following mapping, then put the cursor on the tab and press <F3>. If it shows a highlighting group, type hi GROUPNAME to confirm the highlighting (with GROUPNAME replaced by the last named group in angle brackets). Then adjust your colour scheme to get rid of the underline.

Mapping to identify highlight group:

map <F3> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" . " FG:" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"fg#") . " BG:" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"bg#")<CR>
like image 45
DrAl Avatar answered Sep 24 '22 21:09

DrAl