Reputation: 4809
I believe it's possible to get an underline under the current line, rather than a highlight.
This adds the highlight in my .vimrc:
set cursorline
This is what I've tried adding to get an underline:
:highlight CursorLine gui=underline cterm=underline
But it appears to make no difference.
I'm using vim 7.4.629 on Centos 6.7 through putty, if that helps.
Upvotes: 27
Views: 33790
Reputation: 195169
try :hi clear CursorLine
to clear the current cusorline hl, then :hi CursorLine gui=underline cterm=underline
The color of underline is same as your ctermfg
or guifg
. You can either live with your "colorful" underline, or add cterm/guifg
to make the underlined text and the underline same color.
To only highlight the cursor line when in insert mode
au InsertEnter * set cul
au InsertLeave * set nocul
Copied from another anser by @meteowrite
Upvotes: 30
Reputation: 43
For me it works best to highlight the cursor line only in Insert mode. To do so, I use the action snippet to activate cursor underlining (full line) whenever Insert mode is activated and later deactivating it upon leaving the mode.
au InsertEnter * set cul
au InsertLeave * set nocul
Upvotes: 2
Reputation: 5093
:set cursorline
was the best solution for me, you can combine it with removing the cursorLine as the answer above mentions
Upvotes: 4