vi Singles: (Command executes immediately) iIaArRoOpPY DJxXu(U)sS~ insert, append, replace, open new line, paste, yank one line, delete to end of line, join 2 lines, delete chars, undelete, substitute, swap between upper and lower case Movement: (Command executes immediately) up/down/left/right kjhl CTRL+U CTRL+D wWeEbB number<ENTER-KEY> (jump that many lines down) Combo's: yy (yank/copy 1 line) dd (del 1 line) 5yy p (copy and paste) 7dd p (cut and paste) /searchstring (search for something - use n and N to search again down or up) Commands that need qualifiers: dc Colon Commands: :w :q :w! :q! :wq :w newfilename (save under a new filename - next save reverts back to old filename) :r filename.txt ( read this file into where the cursor currently is) :r!ls ( run this command and drop the results right here) :r!pwd :r ! pwd :r!ls | grep thisfile (running a command, using a pipe and dropping the rsults right here.) :num (tell me current line number) :set nu (turn on line numbers) :split (split the screen - :q to get out of a split) :split filename (split the screen between current file and filename) CTRL+t (if in insert mode then insert a tab) Visual Mode (probably need to have vim installed) v (start selecting from the current cursor position, press an action key (such as y to yank or d to delete) to stop selecting) V (same as above, except line by line) CTRL+v (same as above, except select by block mode) If you give 2 or more filenames on the command line then use :next and :prev to switch between them. For Example: vi file1 file2 :next :prev The power of vi - wow this is cool stuff: Highlight some lines with visual (capital v), then run a command on it with :, run the command !sort or !uniq, etc...: :'<,'>!sort :'<,'>!uniq
Extend your vi here, check out “map” in the .exrc file:
http://grox.net/doc/unix/exrc.php
Try to stay out of caps lock.
When not inserting data remain in vi “command mode”.
These 2 tips will help you navigate vi much easier.