Vim CursorLine color change in insert mode

前端 未结 5 444
天命终不由人
天命终不由人 2021-01-30 11:29

There is good snippet for changing cursor color:

if &term =~ \"xterm\\\\|rxvt\"
  \" use an orange cursor in insert mode
  let &t_SI = \"\\]12         


        
5条回答
  •  青春惊慌失措
    2021-01-30 12:02

    I chose to switch CursorLine and Normal in insert mode. First get the values with :hi Normal and :hi CursorLine. Then adjust the following lines:

    set cursorline
    autocmd InsertEnter * highlight Normal ctermbg=7
    autocmd InsertEnter * highlight CursorLine ctermbg=15
    autocmd InsertLeave * highlight Normal ctermbg=15
    autocmd InsertLeave * highlight CursorLine ctermbg=7
    

    For solarized light, this looks like this. I like the "focus" effect.

提交回复
热议问题