How do I change the color of the selected code in Vim?
There are three selection modes, Visual Line
mode or Visual Block
mode, and selecting wi
I just change my color scheme file (~/.vim/colors/solarized.vim
), and set 'Visual'
to the same value as 'CursorLine'
.
I like the style of CursorLine
as it is transparent and keep the selected elements's syntax highlight color.
Replace the line that contains exe "hi! Visual"
with the following line:
exe "hi! Visual" .s:fmt_uopt .s:fg_none .s:bg_base02 .s:sp_base1
or:
:highlight Visual cterm=NONE ctermbg=0 ctermfg=NONE guibg=Grey40
Like so: