original:
http://www.talug.org/howto/viquickref.html
Author:
www.talug.org
Vi Quick Reference
By The Toledo Area Linux Uses Group
Two Modes VI consists of two modes, command and insert. In command mode, anything typed is taken as an editing command. In insert mode, typed text is inserted into the current document. In both cases,
f - Scroll down Full Searching / string - Search for a string (pattern) of characters n - Search for the next occurrence of the string N - Search for the previous occurrence of the string:% s / str1 / str2 / g - Replace all occurrences of str1 with str2 Copying text yy - Copy a line to the buffer nyy - Copy an n number of lines to the buffer P - Paste text from the buffer above current line p - Paste text from the buffer below current line Changing text r - Mark A Single Character for Replacement R - Go Into over-Write Mode CW - Mark A Word for Changing CC - Mark A Line for Changing ~ - Change The Case of The Current Letter Miscellaneous Commands J - Join A Line with The One Below IT! CMD - EXECUTE A UNIX Command: R - File Read A File Into VI: R! (CMD) - INSERTS The Results of a UNIX Command. - Repeat The Last Command U - undo the last command / change
File Append Lines Numbered N thxt x - Delete a single character dw - delete a word dd - delete an entire line ndd - delete an N Number of Lines D $ or D - delete from the cursor to the end of the line Entering vi vi filename (s) - edit a file or files vi -r filename - retrieve saved version of file after crash vi -x filename - edit encrypted file vi -wn filename - set default window size to n Setting Options Options are either toggled on and off, or given values When editing, set options for a file with the set command:.. set all - displays all option settings on your terminal: set - displays settings set by any current changes: set option - sets option: set option = n - sets option and assigns it the value of n: set nooption - unsets option:? set option - displays setting of option on status lineOption Name Default What Option Does autoindent (ai) noai provides automatic indentation during text entry AutoWrite (AW) NoAw Automatic Saves F ile (write) before searches, control codes, sh escapes ignorecase (ic) noic ignore case during searchs number (nu) nonu show line numbers readonly (ro) noro make file status read only redraw (re) nore simulate smart terminal showmatch (sm ) NOSM Show matching (or {when) OR} Is Entered Term $ TERM Name of Terminal Being Used Warn Warn if No Write Before! CMD
http://www.talug.org