3

How can I make Vim change cursor in different modes so that these conditions are satisfied:

  1. Without using gconftool or such tools. I need this affect only one instance of Vim, not the whole terminal.
  2. This must be working in Gnome Terminal and GVim.

I have tried changing with sample in help gcr, but it only works for GVim, and not Vim in Gnome terminal.

I have tested http://vim.wikia.com/wiki/Change_cursor_shape_in_different_modes, but it changed the cursor for the whole terminal.

Playing with gcr is preferred.

Edit: I know that gcr is only for GUI mode, but I mean some kind of functionality like that inside of vim. May be with some kind of plugin ...

Mostafa Shahverdy
  • 5,342
  • 3
  • 22
  • 34

1 Answers1

5

You won't be able to change it in gnome-terminal as it derives it's cursor settings using gconf and vim is unable to override this.

However, this is what I have in my .vimrc file, using gconf and it works as intended i.e. resets it to what is was before (cursor_shape block). You should be able to use gcr to set the cursor in gvim independently.

" for gnome-terminal
au InsertEnter * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape underline"
au InsertLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape block"
au VimLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape block"
au VimEnter * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape block"
tallus
  • 259