SUMMARY - vi SCREEN EDITOR

General format for commands:
vi[n]operator[m]object
ex:[address]command[options]

1. Invoking and exiting vi6. Searching
$ vi fileinvoke vi/stringfind next string
$ view fileopens file in read-only mode?stringreverse search
:wqwrite and quitnrepeat last / or ?
:wwriteNrepeat last / or ? backwards
:w filewrite to file
:w! fileoverwrite existing file7. Change Text
:qquitrcreplace char with c
:q!unconditional quitnsstring<ESC>substitute n chars with string
cctext<ESC>change line with text
2. Display Textncctext<ESC>change n lines
<CtrL/d>scroll downcwtext<ESC>change word
<CtrL/u>scroll upc$text<ESC>change to end of line
<CtrL/f>page forwardnJjoin n lines
<CtrL/b>page backwardr<RET>split line
:1,$s/string/newstring/gsubstitution
3. Cursor Movement:%s/string/newstring/g
<RIGHT><SP>lnext char
<LEFT><BS>hprevious char8. Copying Text
<DOWN>jchar belowyyyank entire line
<UP>kchar abovenyyyank n lines from current line
<RET>beginning of next lineywyank word
-beginning of previous liney$yank to end of line
GGOTO last linepput after char (line)
:nnGGOTO line nPput before char (line)
$end of line
^beginning of line9. Move Text
wnwWnWforward beginning of worduse delete instead of yank
eneEnEend of word
bnbBnBback beginning of word10. Miscellaneous
xptranspose 2 characters
4. Text Creation:r fileread file into buffer
atext<ESC>append after cursor:!spell %run shell command on current file
itext<ESC>insert before cursor<CtrL/l>redraw screen
otext<ESC>open line below$ vi -r filerecovery
Otext<ESC>open line above
11. Setting Options
5. Delete Text:set numbernumber lines
xdelete char:set nonumberturn off numbers
nxdelete n chars:set listdisplay tabs and end of lines
rcreplace character:set nolistturn off list
dddelete current line:set showmodeindicate input mode
ndddelete n lines:set noshowmodeturn off showmode
dwdelete word:set wm=10define automatic right margin
d$delete to end of line:set wm=0turn off wm
uundo last editing command