rdfs:comment
| - You may start typing, thinking you are in insert mode, but find that the characters are interpreted as commands because you are actually in normal mode. To help avoid that problem, you can specify that the cursor color and blink rate change when entering insert mode. Using gvim with the defaults, the cursor shape is a block when in n-v-c modes (normal mode, or visual selection mode, or command mode while entering a colon command), and the shape changes to a vertical bar when in i (insert) mode. The color and blink rates do not change.
|
abstract
| - You may start typing, thinking you are in insert mode, but find that the characters are interpreted as commands because you are actually in normal mode. To help avoid that problem, you can specify that the cursor color and blink rate change when entering insert mode. Using gvim with the defaults, the cursor shape is a block when in n-v-c modes (normal mode, or visual selection mode, or command mode while entering a colon command), and the shape changes to a vertical bar when in i (insert) mode. The color and blink rates do not change. Here is an example for gvim showing how to customize the cursor properties (see [help 'guicursor']): highlight Cursor guifg=white guibg=black highlight iCursor guifg=white guibg=steelblue set guicursor=n-v-c:block-Cursor set guicursor+=i:ver100-iCursor set guicursor+=n-v-c:blinkon0 set guicursor+=i:blinkwait10 Line 1 defines the color highlighting used for n-v-c modes (set in line 3), and line 2 defines a different color for insert mode (set in line 4). Line 5 disables blinking (blinkon value 0) for n-v-c modes, and line 6 increases the default blink rate for insert mode. Line 4 also sets the cursor shape to a 100% sized vertical bar for insert mode (the default is ver25, a 25% vertical bar. When using ver100 vim doesn't take the guifg parameter. It is better to use block instead). It is possible to change the cursor color and style in the terminal if it understands the following escape sequences. Not all terminals support this, but xterm, rxvt and Terminator do. Recent versions of gnome-terminal support the sequence to change color, but not the one to restore the color to the default. Add the following to ~/.vimrc: if &term =~ "xterm\\|rxvt" " use an orange cursor in insert mode let &t_SI = "\]12;orange\x7" " use a red cursor otherwise let &t_EI = "\]12;red\x7" silent !echo -ne "\033]12;red\007" " reset cursor when vim exits autocmd VimLeave * silent !echo -ne "\033]112\007" " use \003]12;gray\007 for gnome-terminal and rxvt up to version 9.21 endif And changing the cursor shape (rxvt only accepts these escape sequences after version 9.21). if &term =~ '^xterm\\|rxvt' " solid underscore let &t_SI .= "\[4 q" " solid block let &t_EI .= "\[2 q" " 1 or 0 -> blinking block " 3 -> blinking underscore " Recent versions of xterm (282 or above) also support " 5 -> blinking vertical bar " 6 -> solid vertical bar endif If Vim is running in a Gnome-terminal, the cursor shape can be changed as follows: au InsertEnter * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam" 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" The first two lines change the cursor to ibeam/block as it enters/leaves insert mode, the last 2 lines ensure the terminal cursor is independent of vim cursor setting.
|