How to change the highlighted Vim line so as not to be underlined?

In some color schemes, the current line underlines the change in background, in others, for example, Desert, the current line is underlined.

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

My .vimrc :

 set cursorline highlight Cursorline cterm=bold 

Update: .vimrc that fixes the problem

 colorscheme desert set cursorline hi CursorLine term=bold cterm=bold guibg=Grey40 
+65
vim
Dec 27 2018-11-12T00:
source share
5 answers
 color desert set cursorline hi CursorLine term=bold cterm=bold guibg=Grey40 

desert - your color scheme (first)
put it in your ~/.vimrc

+64
Dec 27 '11 at 1:01
source share

This works better (in each terminal) for me.

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

This is the color setting for the terminal: the background color is ctermbg and the text color is ctermfg . To use in the graphics window, add the parameters guibg=darkred guifg=white

You can also select the corresponding column using the command:

 :set cursorcolumn 

It is useful to turn on and off the backlight with a single key press in the editor. Add this line to your vimrc :

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

enter 'H' to turn the backlight on or off (if you want), move it to another key.

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

+34
Jan 23 '13 at 12:04 on
source share

so that the line looks like the one you get in gvim in the terminal, while maintaining syntax highlighting:

 " first thing is entering vim mode, not plain vi set nocompatible " force 256 colors on the terminal set t_Co=256 " load the color scheme before anything colorscheme darkblue " or desert... or anything " the syntax cmd is when the colorscheme gets parse, i think.. syntax on " set the prefered colours, pick one line here only. " dark grey, better you can get if you don't support 256 colours hi CursorLine cterm=NONE ctermbg=8 ctermfg=NONE " light grey, no 256 colors hi CursorLine cterm=NONE ctermbg=7 ctermfg=NONE " dark redish hi CursorLine cterm=NONE ctermbg=52 ctermfg=NONE " dark bluish hi CursorLine cterm=NONE ctermbg=17 ctermfg=NONE " very light grey hi CursorLine cterm=NONE ctermbg=254 ctermfg=NONE " yelowish hi CursorLine cterm=NONE ctermbg=229 ctermfg=NONE " almost black hi CursorLine cterm=NONE ctermbg=234 ctermfg=NONE 
+12
Apr 21 '14 at 4:53 on
source share

If you want to rotate the underline when using either one of:

 :hi CursorLine cterm=underline :hi CursorLine gui=underline 

Otherwise, use one of the following:

 :hi CursorLine cterm=none :hi CursorLine gui=none 
+9
Feb 12 '16 at 18:56
source share

I had a similar problem with setting the cursor selection, but mine was triggered by the mksession command, which I used to save session information during vim's exit. Then this session is automatically restored during program startup if it starts without file arguments.

If anyone has such a .vimrc setting, you can add the following to .vimrc to correctly select the cursor selection: -

 function s:SetCursorLine() set cursorline hi cursorline cterm=none ctermbg=darkblue ctermfg=white endfunction autocmd VimEnter * call s:SetCursorLine() 

Explain a little why this works. Along with various buffer and window information, mksession saves the current color scheme name. This is restored during program startup by restoring the session. However, since session recovery is usually performed after .vimrc is started (usually using a function called through "autocmd VimEnter *"), the cursor selection in .vimrc is reset to the default for the restored color scheme.

The above function, called through autocmd, will be run after all initialization is complete and, therefore, will successfully configure the cursor selection.

NTN.

+7
Aug 04 '14 at 22:48
source share



All Articles