From SpectLog
Jump to: navigation, search

Vim functionality

If you tried to use vi editor on Cygwin after fresh installation, you may notice that:

  • Arrow keys in insert mode produce characters A, B, C, D instead of actually moving the cursor.
  • No color syntax highlights is provided.
  • Undo stack is only one command size.
  • Backspace in command mode only move cursor back. Backspace in insert mode does not visually remove characters, instead, the characters are only overwritten when new ones are typed in.
  • Delete in insert mode simply changes capitalization of the character preceding the cursor and switches vi into insert mode.
  • ... and other weird behavior.

The reference link provides a simple advice. Copy vi example configuration file as you ~/.vimrc and all the above problems disappear:

 cp /usr/share/vim/vim73/vimrc_example.vim ~/.vimrc

Also, make sure you always run vim when you type vi by adding this line to your ./.bashrc file:

alias vi="vim"


Enabling standard clipboard interaction for vim on Cygwin

Disable vim automatic visual mode for mouse [1].This will turn standard terminal copy & paste capabilities (which do not exist in visual mode)

  • issue the command :set mouse-=a
  • insert the directive set mouse-=a into your ~/.vimrc file

Color scheme

Default color scheme renders comments in dark blue color which is too dark in most of the cases. I prefer elflord color scheme among standard one shipped with vim:

colorscheme elflord

Summary: ~/.vimrc configuration file

 set mouse-=a
 colorscheme elflord
 syntax on