砍敺 IT_man 2017-5-6 23:16 蝺刻摩 & y; X: k S% o4 X( x
. D3 Q. z+ J4 J/ l/ b7 z; h7 S
vi隞方牧(摰渡)
2 N7 o, g8 z' x6 o# H- vi 雿璅∪% Q, t3 W; [7 } w3 w
3 f( Y5 b/ M/ G: A0 X; bvi 靘拍車雿璅∪嚗頛詨交芋撘(insert mode)隞斗芋撘(command mode)嗡蝙刻脣 vi 敺嚗批唾冽隞斗芋撘銝嚗甇文駁萄乩隞颱摮 鋡怨箸隞扎冽迨璅∪銝舫脰芷扎靽格寧雿亥頛詨亥嚗脣亥撓交芋撘
5 a$ }2 Z: h5 h3 W4 } 憒雿脣亥撓交芋撘
9 e" [9 T5 ~; R7 N2 l4 s+ K6 n a (append) 望虜璅銋敺亥
" }6 }9 T5 f6 ^7 a# u A 梯府銵銋怠亥
* Q: x, e, @ {$ j2 P+ Z2 F1 n) o$ q i (insert) 望虜璅銋亥7 @/ c# Q& ?+ P: H# k2 C: ?2 ^
I 梯府銵銋擐亥) ^9 s" }/ @/ U' g
o (open) 啣銝銵潸府銵銋銝靘頛詨亥銋具& h/ v+ e* u7 T9 `# {+ e
O 啣銝銵潸府銵銋銝靘頛詨亥銋具, e( Q/ c- a6 d3 `
憒雿a頛詨交芋撘
: Y$ t9 ^5 N# }( v& q7 D ESC 蝯頛詨交芋撘+ c R* p! `! [% k9 u3 O# A5 `
- 隞斗芋撘9 d$ ~6 U2 b- D. }- o
# n5 P$ b' H1 F2 l& B1.皜豢銋蝘餃3 ?' I6 Q0 z: v( A5 Y, E9 L
h 撌衣宏銝摮
! u7 i2 j% S2 J! }2 [, D j 銝蝘颱摮; j, k( A4 t. N7 E) L4 S# f" O
k 銝蝘颱摮8 d( o# B3 s6 a' Y* y$ z2 \; d
l 喟宏銝摮: B8 E7 X: h; Z% t+ q: o
0 蝘餉唾府銵銋擐
- {( w# J' I# F' D7 S $ 蝘餉唾府銵銋怒6 i2 b" P8 }, K/ i
^ 蝘餉唾府銵蝚砌摮
# f; `+ r" U7 W( Z H 蝘餉唾蝒蝚砌
9 p H# ?7 x$ n' r M 蝘餉唾蝒銝剝
0 e2 G5 q" ]) E, P L 蝘餉唾蝒敺銝; b$ m) s* c& i1 ~3 Z7 C) y
G 蝘餉唾府瑼獢敺銝
' K. n! d: L; ~ + 蝘餉喃銝蝚砌摮
' S' {$ s8 p$ n" t! k/ d - 蝘餉喃銝蝚砌摮
; @/ l1 V; R- N# z r ( 蝘餉唾府乩擐 (閮颱)
8 E5 ]0 h- ?# `8 Z# S, Y/ n ) 蝘餉唾府乩怒
' T, u: \5 F2 L& C { 蝘餉唾府畾菔賭擐 (閮颱)" b+ ~% T- c6 h, M
} 蝘餉唾府畾菔賭怒' [0 r4 o8 O; ^
nG 蝘餉唾府瑼獢蝚 n # ]5 p. D+ I. b
n+ 蝘餉單虜璅其蝵桐敺蝚 n * } ?! \7 J! ?* y0 k6 M
n- 蝘餉單虜璅其蝵桐蝚 n # |6 v0 B) Z' N1 r$ t3 A
<Ctrl><g> 憿舐內閰脰銋銵瑼獢蝔晞瑼獢銝剜怨銋銵皜豢刻雿蝮質銋曉瘥$ g( q6 x9 |; Y/ H
閮颱嚗亙(sentence)肖i銝剜舀隞乓嚗.嚗蝯銝銝脣
/ D$ L* _ H8 b5 C% x7 L1 C 閮颱嚗畾菔(paragraph)肖i銝剜舀隞亦征質摮8 n0 y. y0 P# u% q) _6 l. E) `- k
2 A& \$ |2 y' M. W( ?! M) R
2.閬蝒蝘餃 <Ctrl><f> 閬蝒敺銝脖! ^0 r" n8 W1 S5 o) B3 U" \
<Ctrl><b> 閬蝒敺銝脖
2 x7 ]; F/ j4 F l <Ctrl><d> 閬蝒敺銝脣
1 o6 y7 }/ i1 g3 [8 O" V <Ctrl><u> 閬蝒敺銝脣( x- ]; ^* e( N$ p& R* S
<Ctrl><e> 閬蝒敺銝脖銵: U( M5 B/ Q4 {% S! r3 u; z
<Ctrl><y> 閬蝒敺銝脖銵( ~" j1 ^6 E" n4 x9 V1 f* [
' Y/ `5 y2 V) r/ e% u
3.芷扎銴鋆賢靽格寞隞支蝝 (甇文桀頛撠雿輻)
0 u6 y) s6 c9 x4 R: {) _ d(delete)c(change)y(yank)銝憿隞文 vi 銝剔隞斗澆綽; K, L4 Y) g) {1 U, z2 d
Operator + Scope = command6 {3 P0 r4 u/ ?
(蝞摮) (蝭)
! A/ p# W; X' G0 Y 蝞摮嚗
|5 L: I- y8 z d 芷斗隞扎芷方嚗雿撠芷方銴鋆賢啗園蝺抵" F% x }9 Z6 a3 L
y 撠鞈(摮蝯銵亙畾菔)銴鋆賢啁楨銵
8 {) ~+ T5 {! `) K) R p 曄蔭(put)隞歹 d y 雿輻具臬敺deleteyank鞈) W# d8 m* D; d
曄蔭潭虜璅其蝵桐銵銝
0 `# i! ]+ O5 x8 y8 n c 靽格(change)隞歹憿隡寮eleteinsert蝯芷支摮蝯
, J- C7 F) l8 n) n 摮蝑銋鞈嚗銝行交圈菔
* f4 e; @, E* H 蝭嚗3 Y4 j' C1 s7 l
e 望虜璅其蝵株唾府摮銝脩敺銝摮: h3 W* v" V2 S% d" h) z5 e
w 望虜璅其蝵株喃銝摮銝脩蝚砌摮
& ~' z3 D7 k5 U \. j @* E+ Z b 望虜璅其蝵株喳銝摮銝脩蝚砌摮
: m. q. Q. a1 j" K! O$ {, L $ 望虜璅其蝵株唾府銵敺銝摮6 p- B, {9 W; I8 c$ q
0 望虜璅其蝵株唾府銵蝚砌摮
6 W* S7 J( L" |" H ) 望虜璅其蝵株喃銝亙蝚砌摮( r) F+ ]; N' f; B! H# J
( 望虜璅其蝵株唾府亙蝚砌摮
& }. W, _: b" U! y6 n+ z, l' \0 ]2 k { 望虜璅其蝵株唾府畾菔賜敺銝摮
0 e) f6 t0 K3 h- d, P- L6 A } 望虜璅其蝵株唾府畾菔賜蝚砌摮* i4 \$ m; z3 s9 v
渲雿
# o9 G- B2 A2 |" f' u' Z$ d- C dd 芷斗渲
: S7 b# S( @" v6 N! N D 隞亥箏桐嚗芷斗虜璅敺銋摮: I$ A! B5 b! Y1 t2 r! d/ j
cc 靽格寞渲批捆
9 p/ |- Z* I- d# k yy yank渲嚗雿踵虜璅刻府銵銴鋆賢啗園蝺抵; c8 |9 w+ J( X$ a
& o8 a. W) M) |- L& D: t: F4.芷方靽格
; Q6 \: m, r3 g+ ]; P* H) ^ x 芷斗虜璅刻府摮2 m, Q/ q, l7 n8 j5 c
X 芷斗虜璅其銝摮
8 [6 P* |; a8 x+ f3 Y dd 芷斗虜璅刻府銵1 t& r9 [- D K; s. M/ d! O& p
r 冽交潭迨隞支敺摮隞(replace)皜豢典, f4 d: A& I# }; ^% J. f
憒嚗 ra 撠皜豢典隞 a 隞銋1 e& Z9 E; R9 ^# C, o5 e7 I
R 脣亙隞嚗游啜ESC箸迫( V: ] D% f8 U0 P8 B; ]' J# B
s 芷斗虜璅其摮嚗銝阡脣亥撓交芋撘游啜ESC( y, z( }- N; p/ k" P) m
S 芷斗虜璅其閰脰鞈嚗銝阡脣亥撓交芋撘游啜ESC# d: ]8 ]! {) T4 l3 M
. r {0 H. I( l6 L4 }* e* U* |6 `
5.祉宏銴鋆
8 d. s7 D+ E8 Z2 q+ c 拍牡elete put 隞文臬鞈祉宏銋桃
4 |# l, x; U* U9 o! p+ z 拍肘ank put 隞文臬鞈銴鋆賭桃/ R: t) A( R1 I
yank delete 臬摰鞈銴鋆賢啗園蝺抵嚗 put 隞/ P/ {2 ^0 y0 E) V
臬蝺抵抒鞈銴鋆賢啗W銝
4 }; \& g* S" K7 @ 靘嚗, Z% N, V5 m& e: b$ R& l; ^
祉宏銝銵 批刻府銵瑁 dd
+ [* U: N3 S' t" i 扳虜璅蝘餉喟桃
' \+ @3 a1 l1 F 批瑁 p
7 q% H% a: z, M: T3 Z3 p' Z9 u6 B 銴鋆賭銵 批刻府銵瑁 yy' t" Q/ G; k. f( \9 A
扳虜璅蝘餉喟桃
* N! @. h. S' e0 H 批瑁 p
2 | `* ?7 H3 f1 P/ ]/ l: z9 T1 b! O9 ]4 k
6.隞日銴
, D+ ]4 f! N) J' ]5 L o 冽隞斗芋撘銝哨臬冽隞文W乩詨 n嚗甇斗隞文雿銴瑁 n3 O) M: } M$ W. a8 w
甈∼
* H$ e' B& C u' J# z! _/ M8 s0 j 靘嚗% v2 F, N/ T+ Z; h
芷10銵 10dd
0 F. z. ]: ?1 H# I5 x! b& L3 F4 n; m 銴鋆10銵 10yy
- m3 ]* ~' K( Q* g1 w9 n$ X 扳虜璅蝘餉喟桃1 p! _' \' `3 X8 C; l
吠5 B. P% F* [ N2 x
璅敺銝蝘10銵 10j1 r8 d, d7 j' X4 j7 @8 t
u# f( e0 W9 Z1 u4 B" y7.瘨銝雿(Undo)
5 K0 t7 H. u5 a5 o1 @/ B/ m- E 喳儔瑁銝銝隞文批捆* }/ Q& o* i# m' Q
u W儔敺銝隞支蝯
7 B: M7 V4 p/ ~* L, U1 n9 K" B U W儔皜豢閰脰銋寡
0 E5 S* J7 C: |& {% [1 S# k+ h) A- ?
8.撠- Y; J8 _ ], B# y: }
肖i銝剖舀撠銝摮銝莎雿踵虜璅蝘餉唾府
! o3 A2 ]- n9 \, `# h2 f) C( { /摮銝 敺皜豢銋敺撠曇府摮銝脯* }! l s6 n/ q+ k7 S) p, D' Y9 W
?摮銝 敺皜豢銋撠曇府摮銝脯
6 ]! L' g/ _. ~7 |) V9 D$ v# S2 p2 d n 敺銝蝜潛撠曆銝詨摮銝脯) }7 v9 L) V4 l) r
N 敺銝蝜潛撠曆銝詨摮銝脯3 P; U, D+ e5 f+ L! ^/ b
! X) W6 g7 I+ Q6 w- I( q9.鞈
8 s1 A. y# W. w9 n7 O! N J 亙乓撠皜豢其銝銝銵亥單虜璅閰脰敺U
, n/ ~; n- K1 e+ e; X 交銵鞈憭芷瑚漲臬嗅抵嚗芾撠皜豢蝘餉喳暺嚗脣亥撓交芋撘% ], {# f9 A1 A. _' [" D
(臬拍災i蝑隞)Enter喳胯. I! B. l* l6 M) A7 c, O
- Q" O6 Y9 e$ B) k* z( B9 j
10.啣閮剖
! {, y; ~. E4 s; }0 C5 M 嚗setnu 閮剖鞈銵0 J" t5 i, j! | H D
嚗setnonu 瘨銵閮剖
9 t. p8 F- \6 f8 v: q3 a 嚗setai 芸抒葬
- h4 F' Z) X8 o7 E 嚗setnoai 瘨芸抒葬
i( z" {8 _. c( S/ h7 l$ ]1 p 芸抒葬(automatic indentation)( b) O1 g% X3 `& v
函楊頛舀隞嗆蝔撘嚗圈閬抒葬瘜嚗嚗set ai單靘
! W$ Q C$ s. N$ V( y 抒葬踝其靘閫銋嚗+ e' M n% x$ r' a _* m; |/ G q6 {
听i test9 R7 Z: w3 K) \, q/ H5 F2 _
(脣亦楊頛航蝒敺)' R* T1 c" C" o2 Q
this is the test for auto indent
" `3 ?+ Y* l% K& ?- v Tabstart indent 嚗set ai (閮剛芸抒葬)
8 s M5 |6 G1 p& A( b0 s9 C Tabdata
5 R! b" g8 y0 V$ H5 p# x; c8 ?# w Tabdata
3 F" z' \" ^9 H6 R4 [2 _' b Tabdata 嚗set noai (瘨芸抒葬)
4 }3 m; F2 w1 B' _; X the end of auto indent.
+ ?; O# P- D. J1 u& R3 Y$ q 扯酉嚗<Ctrl><d>臬芷扎Tab摮
+ B E7 {- f# \, }$ I
^ _9 p; K* U$ X" D4 Q11.ex隞! `9 e, T/ @( [2 Z
霈撖怨
8 W4 R3 ?; I5 b& m* P7 h# o 嚗w 撠蝺抵鞈撖怠亦蝣銝准
0 g0 p: W3 E/ v3 h3 R 嚗10,20wtest 撠蝚10銵喟洵20銵鞈撖怠另est瑼獢* k! M* f0 J5 ~ `$ g1 J
嚗10,20w>>test 撠蝚10銵喟洵20銵鞈系est瑼獢銋敺" H) W" x. J. |' V
嚗rtest 撠test瑼獢鞈霈亦楊頛舐楨銵敺0 X- T9 s& g! J x2 [5 w( ~
芷扎銴鋆賢祉宏* s* r+ s0 G$ ]
嚗10,20d 芷斤洵10銵喟洵20銵鞈# \# D3 [. D5 q8 u2 z3 {8 r: f
嚗10d 芷斤洵10銵鞈' M: ~' c/ N& o* @, y/ {
嚗%d 芷斗游蝺刻摩蝺抵4 [6 r, `5 d) H0 S( k2 U, e
嚗10,20co30 撠蝚10銵喟洵20銵鞈銴鋆質喟洵30銵銋敺4 t# t1 B/ I y/ `; A" X
嚗10,20mo30 撠蝚10銵喟洵20銵鞈祉宏喟洵30銵銋敺
( J2 M/ X& ?% ?- ~" k6 A3 n 摮銝脫撠隞8 t: G) r& C# y2 i
s(substitute)隞文舀撠銵蝭
0 P) h+ x: d g& y7 ?$ W, n g(global)隞文舀撠游蝺刻摩蝺抵鞈0 x: x }! N1 [# }+ H7 l. v
s隞支誑蝚砌皛輯雲閰脫隞嗥摮銝脩箏嗅隞撠鞊∴亥府銵詨皛輯雲閰脫/ Q9 N [4 p% ] q; }
隞嗥摮銝莎銋賢隞蝚砌嚗交喳隞摮銝脣銝g詻0 z# g: ~% a4 M5 C) f) d
嚗1,$s/old/new/g 撠瑼獢銝剜old寞new
p& j+ @4 [& u+ k3 q 嚗10,20s/^/ / 撠蝚10銵喟洵20銵鞈X5蝛箇賬' \0 q; E7 n) ]0 i+ e: a+ K( f1 Q
嚗%s/old/new/g 撠蝺刻摩蝺抵銝剜old寞new* D) ] H! r0 \3 j6 }
) s) `- x$ F) o& V4 b12.W儔蝺刻摩鋡思葉瑞瑼獢
: R" X+ i; o1 i( A" p9 a 函楊頛舫蝔銝哨亦頂蝯梁嗆蝺銝剜瘀蝺抵鞈銝阡( E7 p& n ?/ _/ f# B5 Q H7 F
鋡怠神蝤蝣嚗嗅摨血啁頂蝯梧瑁銝隞文喳臬敺拐葉瑕4 F# k' D% Y3 R( J9 M# ]; L
瑼獢批捆" ]0 Z5 s' n" o6 T* P% v
%vi -r filename
4 A$ Y$ U; S% X* U+ m6 j5 \8 c. _5 ?' h
9 _; ^. j( }; e& U) A. H( k% w13.蝺刻摩憭瑼獢* a7 q) |2 q/ `- N0 f
vi鈭行靘蝺刻摩憭瑼獢踝寞憒銝嚗& `6 L. q c; i/ T
%vi file1 file2 ..+ M( f+ \3 D7 H6 W/ d# F
嗥洵銝瑼獢蝺其耨摰敺嚗臬拍具嚗w撠閰脩楨銵摮瑼嚗敺, C' E5 H* }" V) e) O1 H+ `
拍 嚗n頛乩銝瑼獢4 H9 F- I' g' j9 k$ _" r
# f( ?, V4 O0 }7 D:
3 J/ J& ^+ j( J- {% h# c# F8 Y2 X4 n4 R' _6 W, B g0 Y2 z
http://chunchaichang.blogspot.tw/2010/08/vim-s.html
- b4 M/ R' D. }( z! c: r7 O |
|