Vim: Notes and Cheats

1 minute read

So according to my good friend Wikipedia Vim is a clone, with additions, of Bill Joy’s vi text editor program for Unix. Vim’s author, Bram Moolenaar, based it upon the source code for a port of the Stevie editor to the Amiga and released a version to the public in 1991

hjkl - moving around in vim
i  - insert mode.
A  - append mode same as insert mode.
ESC -  goes to normal mode.
x - delete a character.
dw - delete from the cursor up to the next word.
d$ - delete from the cursor to the end of a line type.
2w - move cursor 2 words forward.
3e - to move the cursor to the end of the third word forward
0 - (zero) to move to the start of the line.

d2w -  to delete the two words
dd - deletes a whole line.
2dd - deletes two lines
u - undo previous actions,.
U - undo all the changes on a line.
CTRL-R - undo's the undo's.

p - To put back text that has just been deleted. This puts the deleted text AFTER the cursor (if a line was deleted it will go on the line below the cursor).
r then a <character> - replaces the cursor with <character>
ce <word> - deletes text from cursor location add <word> where text was. The change operator allows you to change from the cursor to where the
     motion takes you.  eg. Type  ce  to change from the cursor to the end of
     the word,  c$  to change to the end of a line.