0. "[a-z](command) stores into the buffer you specify. "[a-z](command) uses the data in the buffer you specify. "1pu.u.u... goes through the history of the edits. :ab "name" William Kevin Earls\n (abbreviation of my name insert name and my name will appear. '' returns to the last line changed. 1. :!command executes a unix system command. Some useful examples are: :!ls - shows a directory listing of your area. :!rm FILENAME - removes file FILENAME from your area. 2. :w FILENAME writes the current vi file to disk with name FILENAME. 3. :#,# FILENAME saves the lines # through # in file FILENAME. 4. :w >> FILENAME appends current file to file FILENAME. 5. :r FILENAME retrieves disk file FILENAME and inserts it into the current file following the cursor position. 6. :r!command executes a unix command and places the output after the line with the cursor. 7. !command passes the text indicated by the movement command through a Unix command. Example: !}sort To process a single line use: !!command To process the entire file: :%!command 8. mx establishes a text marker x (could be a to z). One can then return to the line with that marker with the command: 'x. 1. ^D moves down 1/2 page in the file. ^U moves up 1/2 page in the file. 2. ^F moves down 1 page in the file. ^B moves up 1 page in the file. 1. Ctrl-g displays your location in the file and the file status. Shift-G moves to the end of the file. A line number followed by Shift-G moves to that line number. 2. Typing / followed by a phrase searches FORWARD for the phrase. Typing ? followed by a phrase searches BACKWARD for the phrase. After a search type n to find the next occurrence in the same direction or Shift-N to search in the opposite direction. Watch out for the special characters used in Unix regular expressions: /\^$.*[] To turn off the special meaning of these characters :set nomagic 3. Typing % while the cursor is on a (,),[,],{, or } locates its matching pair. To show the matches as text is typed in: :set showmatch 4. To substitute new for the first old on a line type :s/old/new To substitute new for all 'old's on a line type :s/old/new/g To substitute phrases between two line #'s type :#,#s/old/new/g To substitute all occurrences in the file type :%s/old/new/g To ask for confirmation each time add 'c' :%s/old/new/gc ^L - refresh the screen ^Q - to restart a session stopped by ^S ^Z - suspends vi and returns to shell prompt; to return to vi: fg xp - reverse two characters deep - reverse two words (start at the space in front of first word) J - join 2 lines B - same as b but ignores all characters except blanks, tabs, and newlines in finding start of previous word. E - same relation to e as B to b. W - same relation to w as B to b. ~ - reverse case :vi - return to vi from ex : prompt :ab - define an insert mode abbreviation >> - shift line "shiftwidth" characters to the right. << - shift line "shiftwidth" characters to the left. '' - return to last created marker or text change location. ^F (^B) pages forward (backward) ^D (^U) half pages down (up) h j k l moves the cursor left down up right G (1G) goes to end (top) of file w (b) moves to next (previous) word e moves to next end of word 0 ($) puts cursor at start (end) of line ^ moves to first nonblank on line + moves to first nonblank on next line n| moves to column n on line - same as + but to previous line ma sets position marker "a" { (}) moves cursor before (after) paragraph `a returns to marker "a" /pattern searches forward for pattern 'a returns to front of line w/ "a" ?pattern searches backward for pattern '' returns to last marker/change n (N) redo / ? in same (reverse) direction ^E to move screen up 1 line % shows matching () {} [] ^Y to move screen down 1 line