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 ...

2
  • gcr will not satisfy your requirements, since this is for, as its name states(guicursor), a GUI. Did you read the vim help file for gcr? It clearly states: "only available when compiled with GUI enabled, and for MS-DOS and Win32 console" Mar 8, 2013 at 8:51
  • Yeah, of course it is for GUI, And that's why I asked for help! Mar 8, 2013 at 15:02

1 Answer 1

5
+25

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"
2
  • 1
    This is wrong. This will affect other instances of VIM and gnome-terminal itself. If I kill my VIM suddenly, then the cursor won't change back to its normal. The worst thing is that If I open more than one instance of VIM in different modes, all will be cluttered! Mar 10, 2013 at 3:26
  • This is actually a nice feature. I prefer to have the cursor always the block shape and the same for the terminal. (Nice feature when sitting in the sun :-) I use the status bar to recognize command/insert/replace modes. Jul 7, 2013 at 14:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .