Mug Of VI
FILE COMMANDS
SEARCH AND REPLACE
DELETING/INSERTING TEXT
CUT/COPY/PASTE
MOVING AROUND
WICKED COOL STUFF
| vi filename(S) | edit a file or files |
| vi -r filename | retrieve saved file after crash |
| ZZ, :wq, :x | save and exit |
| :q, :q! | quit;quit without saving |
| :w. :w fn | save file, save file as fn |
| :e filename | edit filename |
| :r filename | insert filename |
| :sh | drop to shell |
| :!cmd | run command cmd |
| :r !cmd | execute cmd and insert output |
| !movement cmd | pipe lines in movement through cmd |
| /txt, ?txt | find txt forward or backward |
| ?^txt | find next line that starts with txt |
| n, N | repeat last search forward, backward |
| R | replace text from current character |
| dw w, dd, x | delete word, line, character |
| ndd, nx | delete n_ lines, _n characters |
| x, X | delete character forward,backward |
| D, D$ | delete to end of line |
| d motion | delete from cursor to motion ($,0,etc.) |
| :>, :< | indent, outdent line |
| S | replace text with blank line |
| o, O | insert new line below, above current line |
| u | undo last change |
| . | repeat last change |
| nyy, nY | copy n lines |
| yw, yy | copy word line |
| p, P | paste text after,before cursor |
| a, i | insert text after ,before cursor |
| A, I | insert text end, beginning of line |
| nG | move to line n |
| h, l, k, j | left,right,up down one character |
| nb, nw | left or right, n words |
| CTRL-B, F | backward, forward one screen |
| CTRL-U, D | up,down one screen |
| $, G | go to end of line, end of file |
| O | go to beginning of line (zero) |
| ), ( | move to next, previous sentence |
| },{ | move to next,previous paragraph |
| w, b | move forward, back one word |
| e | go to end of current or next word |
| ~ | change case |
| xp | transpose characters |
| j | combine current line with next |
| mp | create a mark called p |
| `p | return to p |
| d`x, y`x | del,copy text from mark to cursor |
| :>n | indent n lines |