Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change my Vim highlight line to not be an underline?

Tags:

vim

In some colorschemes the current line highlighting changes background, in others, like Desert, the current line is underlined.

I want to change the current line highlighting in Desert to use a different background color instead of underlining. How can I do that?

My .vimrc:

set cursorline highlight Cursorline cterm=bold 

Update: .vimrc that solves the issue

colorscheme desert set cursorline hi CursorLine term=bold cterm=bold guibg=Grey40 
like image 456
ashim Avatar asked Dec 27 '11 00:12

ashim


People also ask

How do I highlight a line in Vim?

If you want to select the entire line in a file, press V. Now when you press k or j to go up and down, vim will select the entire line above and below your cursor.

How do you underline in Vim?

You can either live with your "colorful" underline, or add cterm/guifg to make the underlined text and the underline same color.

How do I highlight the current word in Vim?

To automatically highlight the current word, type z/ .


2 Answers

color desert set cursorline hi CursorLine term=bold cterm=bold guibg=Grey40 

desert is your colorscheme.(should come first)
put it in your ~/.vimrc

like image 176
kev Avatar answered Nov 16 '22 00:11

kev


This works better (in every terminal) for me.

:hi CursorLine   cterm=NONE ctermbg=darkred ctermfg=white 

It is setting of color for terminal: background color - ctermbg, and text color - ctermfg. For using in graphical window, add parameters guibg=darkred guifg=white

You can highlight the corresponding column as well, using the command:

:set cursorcolumn 

It is useful to toggle highlighting on and off by pressing one key in the editor. Add these line to your vimrc:

:nnoremap H :set cursorline! cursorcolumn!<CR> 

typing 'H' will toggle highlighting on and off (Map it to another key if you want)

You can find more info in the article: http://vim.wikia.com/wiki/Highlight_current_line

like image 42
srnka Avatar answered Nov 16 '22 00:11

srnka