VI command how commonly used, put in this for reference.
% VI File
:
Last line mode----> Command mode----> Insert mode
<----<----
(Auto) Esc
Last line mode:
/exp go forward to Exp
? exp Go backward to Exp
: w Write Buffer to disk
: w newfile Write buffer to NewFile
: w! File Write Absolutely
: Q Quit Editor
: q! Quit,discarding Buffer
: Wq Write Buffer and quit
: x Write if needed & quit
: F Edit & File Status
: R Read file into buffer
: R file Read named file in
: E (Re) Edit file
: e! (Re) Edit,discard file in
: E file Edit nameed file
: 3,8d Delete Lines 3-8
: 4,9m lines 4-9 to 12
: 2,5t Copy lines 2-5 to 13
: 5,9w file Write lines 5-9 to File
: S/old/new/current line,sub the "old" w/"new"
: s/old/new/g current Line,sub the "old" w/"new"
: 3,9s/old/new Lines 3-9,sub the "old" w/"new"
:%s/old/new all lines,sub the "old" w/"new"
:%s/old/new/g all lines,sub the "old" w/"new"
: S/pat./new A. Matches any charcter
: s/pat*/new A * matches 0 or more "T" s
: S/pa[0-9aeioa-z]/new selection Set or range
: s/pa[^aeiou]/new Match any Non-vowel
: S/^pat/new anchor "par" to beginning of line
: S/pats/new anchor "par" to end of line
:s/old/& and New/restoe matched pattern on sub
:%s/./&/indenta Whoie file
: Set Nu Display Line numbers
: Set Nonu Turn off option
: Set all Show all settings
: Set list Try to display invisible chars
: Set wm=5 Wrap lines 5 sp from R margin
Command Mode: This article is from http://bianceng.cn (learn computer)
<-| ->
HLJK Cursor Movement
G Goto last file line
3G Goto Line 3
0 Goto Line Start
$ Goto Line End
% Goto Matching Brace/paren