====== vi Editor commands ====== ===== Navigation ===== k 1G | h 0 -------------$ l | G j l - forward one character \\ h - back one character \\ k - up one line \\ j - down one line \\ w - forward one word \\ b - back one word \\ $ - end of line \\ 0 - zero - start of line \\ G - bottom line \\ nG - move to line n \\ ===== Editing modes ===== a - append after cursor \\ A - append at end of line \\ i - insert before cursor \\ I - insert at beginning of line \\ r - replace character \\ R - Overtype charachers \\ u - undo last change \\ U - Undo all changes \\ o - open new linebelow \\ O - open new line above \\ J - Join line below to line above \\ ===== Saving and exiting ===== :w - save, use existing name \\ :wq - save and quit \\ :q - Just quit if doc saved \\ :q! - Quit even if unsaved changes \\ :w - Save with new filename \\ :r - read in file, start at current cursor position \\ Ctrl-g - Check currnet name of file \\ ===== Searching ===== / - search for forward \\ ? - search backwards for \\ n - next match of search \\ N - previous match of search \\ ===== Copy, paste, change and delete ===== x - delete current cursor \\ dd - delete or cut whole line \\ dw - delete or cut current word \\ d2w - delete or cut two words \\ yy - yank (copy) whole line \\ y3w - yank 3 words \\ y$ - yank to end ok line \\ p - paste after cursor \\ P - Paste before cursor \\ cw - change word \\ cc - change entire line \\ c4l - change next four characters. \\ Place a number to repeat an action, \\ eg. \\ 3w - move three words forwards\\ 4j - move down 4 lines \\ 4x - delete 4 characters \\