vi Help ---------------- ----------------- Editing Commands Deleting Commands ---------------- ----------------- i insert x delete character o open a new line (below) X delete character to left O open a new line (above) d0 delete to beginning of line a append d$ delete to end of line A append at end of line dd delete line u undo 5dd delete 5 lines . repeat last command ------------------- ----------------- Cutting and Pasting Movement Commands ------------------- ----------------- yy yank H move to top of screen (high) 5yy yank 5 lines M move to middle p paste L move to low P paste above current position 10G go to line 10 w go to next word b go back to previous word 0 beginning of line $ end of line ------------------ Searching Commands ------------------ /fred search for "fred" ?fred search backwards for "fred" n repeat the last search ---------------------------------- Function Key Mappings (Customized) ---------------------------------- F1: show the .exrc file F2: show .vi_help (this file) F3: set number F4: set nonumber --------------------- Run External Commands --------------------- :!ls -al list current directory (long list) :!pwd print working directory ---------------------- Miscellaneous Commands ---------------------- :r read contents of a file into the current file :s/FRED/BARNEY/g swap FRED with BARNEY (current line only) :10,20s/FRED/BARNEY/g swap FRED with BARNEY on lines 10 through 20 :1,$s/FRED/BARNEY/g swap every occurrence of FRED with BARNEY (entire file) :10,20d delete lines 10 through 20 :10,20y yank (copy) lines 10 through 20 to the buffer :r !sort somefile read contents of somefile after sorting :r !date read output of date command into file at cursor point :69,72!sort sort lines 69-72, and replace whatever was in 69-72 ---------------- Auto-Indentation ---------------- Your ~/.exrc file is configured to automatically indent each line. To move backwards (and eliminate indentation), hit ^d ---------------- MISC ---------------- shell script from "Learning the VI Editor" Chapter 7/Advanced Editing/Here Documents/page 124 ---- for file in $* do ex - $file << E_O_F g/thier/s/ /their/g g/writeable/s/ /writable/g g/qoute/s/ /quote/g g/blockqoute/s/ /blockquote/g wq E_O_F done ----