Change cursor style when entering INSERT mode

2 Points

Steven Loria Steven Loria

10 years ago

Changes cursor style from "box" to "vertical line" when going from normal to insert mode.

" Change cursor style when entering INSERT mode (works in tmux!)
if exists('$TMUX')
  let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
  let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
  let &t_SI = "\<Esc>]50;CursorShape=1\x7"
  let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif

ReneFroger

ReneFroger 10 years ago

For Gvim I have this snippet:

" Block cursor config { if $COLORTERM == 'gnome-terminal' au InsertEnter * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_blink_mode on" au InsertLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_blink_mode off" au VimEnter * silent execute "!xterm -cr darkred" else highlight Cursor guifg=orange guibg=#750000 highlight iCursor guifg=orange guibg=#750000 set guicursor=n-v-c:block-blinkon0-blinkoff0 set guicursor+=i:ver20-blinkwait1-blinkoff0 endif