How to set vim/gvim on windows?

Using the following steps one can setup vim/gvim to run on windows. 1) Add the following new variable VIM on your system. Example: VIM=C:\apps\vim\vim73 (Where C:\apps\vim\vim73 is where vim/gvim is installed) 2) Copy the file %VIM%\vimrc_example.vim as _vimrc in %VIM% folder 3) Add the following 2 lines at the end in %VIM%\_vimrc so it sets…

Movement commands in vi

Move by one character h – Move cursor left j – Move cursor down k – Move cursor up l – Move cursor right Move by word w or W – Move forward by word, cursor is beginning of the word b or B – Move backward by word, cursor is beginning of the word…

Commands to change cursor position in vi

h – Left l – Right k – Up j – Down w – Move forward to beginning of next word e – Move end of the word b – Move backward to beginning of the previous word 0 – First position on the line $ – Last position on the line ^ – First…

Useful commands in vi to save/quit

There are few commands one can use to save a file n To save and quit: <esc>:wq To save (if modified) and then quit, if not modified then does not save quit: <esc>:x (by jwood@opsource.net) To save (if modified) and then quit, if not modified then does not save quit: <esc>ZZ (by boomslaang@hotmail.com) To save…

Useful commands in vi to delete

Useful commands in vi: To delete lines One at a time: <esc>dd n lines at a time: <esc>ndd – where n is the number of lines to be deleted, eg: 3dd would delete 3 lines To delete all blank lines (lines that don’t have spaces in between): <esc>:g/^$/d To delete all blank lines that have…