I want to set the cursor to I-shape and red-colored in all modes, but after setting the vimrc:
let &t_SI.="\e[5 q" "SI = INSERT mode
let &t_SR.="\e[5 q" "SR = REPLACE mode
let &t_EI.="\e[5 q" "EI = NORMAL mode
it does not change
I want to set the cursor to I-shape and red-colored in all modes, but after setting the vimrc:
let &t_SI.="\e[5 q" "SI = INSERT mode
let &t_SR.="\e[5 q" "SR = REPLACE mode
let &t_EI.="\e[5 q" "EI = NORMAL mode
it does not change
Because this vim is using mouse=a
by default.
mouse=a
means all previous modes, but it disabled I-shape.
Try to add set mouse=vic
in ~.vimrc
.
There is the info of mouse
setting for vim:
:help mouse
Enable the use of the mouse. Works for most terminals (xterm, Win32
|win32-mouse|, QNX pterm, *BSD console with sysmouse and Linux console
with gpm). For using the mouse in the GUI, see |gui-mouse|. The
mouse can be enabled for different modes:
n Normal mode and Terminal modes
v Visual mode
i Insert mode
c Command-line mode
h all previous modes when editing a help file
a all previous modes
r for |hit-enter| and |more-prompt| prompt
Normally you would enable the mouse in all five modes with: >
:set mouse=a
If your terminal can't overrule the mouse events going to the
application, use: >
:set mouse=nvi
Then you can press ":", select text for the system, and press Esc to go
back to Vim using the mouse events.
In |defaults.vim| "nvi" is used if the 'term' option is not matching
"xterm".
If you do not want mouse=a
or mouse=n
, then cursor does not point to selected letter in text.
set mouse=vic
is equal to mouse=a
it’s default is:
Normal mode: block
Insert mode: I-style
Hello
In terminal vim you can’t change cursor style or color. You need to set it from what ever terminal you are using.
For gVim ( graphical ) see :help guicursor
for shape in modes.
Ex. for cursor shape set guicursor+=i:block-Cursor " for gVim insert mode
Colors change them according to your preference:
highlight Cursor gui=reverse guifg=#89ddff guibg=bg
highlight Visual gui=reverse guifg=#82aaff guibg=bg
au InsertEnter * highlight Cursor gui=reverse guifg=#bb80b3 guibg=bg
au InsertLeave * highlight Cursor gui=reverse guifg=#89ddff guibg=bg
Personally I have disabled mouse and this works for colors.
Cheers…
Thanks! I just mean guicursor of gvim. I think I have the wrong config.
But I see both show the different cursorstyle. mouse=vic
shows the cursor as I-shape in vim, others not.