砍敺 IT_man 2017-5-6 23:16 蝺刻摩
1 `5 A8 W- s5 u4 n) _/ Z, r' Y) Q& v% R
vi隞方牧(摰渡)
, z2 \( C9 I) `, v% v( z* @) j- vi 雿璅∪
- C4 V/ \3 q6 d4 N! z
) t* B" U( ?" k# T6 m
vi 靘拍車雿璅∪嚗頛詨交芋撘(insert mode)隞斗芋撘(command mode)嗡蝙刻脣 vi 敺嚗批唾冽隞斗芋撘銝嚗甇文駁萄乩隞颱摮 鋡怨箸隞扎冽迨璅∪銝舫脰芷扎靽格寧雿亥頛詨亥嚗脣亥撓交芋撘 4 N5 Z5 C& h1 t: \1 S
憒雿脣亥撓交芋撘' p: u1 L+ g0 }+ p
a (append) 望虜璅銋敺亥& B2 G* O- k& E3 r% v! m0 x9 U
A 梯府銵銋怠亥( P2 N, \/ G0 p E' F3 \5 s
i (insert) 望虜璅銋亥6 L' h& v7 T I: o3 E
I 梯府銵銋擐亥
% k% K) G1 }" K9 b) Y o (open) 啣銝銵潸府銵銋銝靘頛詨亥銋具
* M0 Y' f3 d, G" e/ R O 啣銝銵潸府銵銋銝靘頛詨亥銋具% c* t9 U# i0 U5 T2 h6 E
憒雿a頛詨交芋撘
$ f3 ?1 o) E& K9 f9 ] ESC 蝯頛詨交芋撘
/ o6 h9 G5 i8 W * T9 y8 B l$ d0 p. P; [
1.皜豢銋蝘餃; E& W8 V4 u$ U3 z$ C. G3 o# K
h 撌衣宏銝摮
( g# u w2 r& |5 z2 d- ^ j 銝蝘颱摮+ C% J; D' _( x6 Y
k 銝蝘颱摮
- f' V1 X( |, O( g& D% O; ?' n# { l 喟宏銝摮: V, x# v' E: V5 L
0 蝘餉唾府銵銋擐
$ i- ]1 \) c8 t. k$ Y; u, B $ 蝘餉唾府銵銋怒6 g, u2 a1 {4 \7 s3 g
^ 蝘餉唾府銵蝚砌摮8 N/ L. P1 H7 N2 r& P* S
H 蝘餉唾蝒蝚砌
/ P6 p9 ~" R2 Z4 T& | M 蝘餉唾蝒銝剝0 E! P! E; j. `9 o
L 蝘餉唾蝒敺銝
3 m! A# ~& H% ~ G 蝘餉唾府瑼獢敺銝8 o- H1 Y, O. v/ ]' [, @! @% D( q8 d+ B( L
+ 蝘餉喃銝蝚砌摮$ L, |( @' E4 }# Z5 J$ {$ @
- 蝘餉喃銝蝚砌摮
# r& V8 W' m) i- z* K ( 蝘餉唾府乩擐 (閮颱)
0 {0 h$ c+ E) _0 T ) 蝘餉唾府乩怒
6 A+ I, P0 l# v$ s- q { 蝘餉唾府畾菔賭擐 (閮颱)
# _0 }: x7 i3 T" _7 m: X; ~ } 蝘餉唾府畾菔賭怒7 i2 A- u: T3 k4 j& ?9 R8 Z/ `
nG 蝘餉唾府瑼獢蝚 n
7 T: i4 e( q% d& H0 ~ n+ 蝘餉單虜璅其蝵桐敺蝚 n 5 S5 c* b) C) n9 x1 y5 L. O* q }
n- 蝘餉單虜璅其蝵桐蝚 n 4 J* E, B. ^7 O' r
<Ctrl><g> 憿舐內閰脰銋銵瑼獢蝔晞瑼獢銝剜怨銋銵皜豢刻雿蝮質銋曉瘥
; [; V. @: \5 p2 }& G" k/ K 閮颱嚗亙(sentence)肖i銝剜舀隞乓嚗.嚗蝯銝銝脣
) t$ @, o3 `9 }9 l9 j- G) U1 X' i 閮颱嚗畾菔(paragraph)肖i銝剜舀隞亦征質摮
" Z, v2 I3 }) M5 {) Q9 H0 Y7 w! \/ h9 H5 V
2.閬蝒蝘餃 <Ctrl><f> 閬蝒敺銝脖
3 S& g: h+ k. p6 t! |2 M! C+ U <Ctrl><b> 閬蝒敺銝脖
4 Q% v& a- F9 o, Q) K1 O. w O2 m <Ctrl><d> 閬蝒敺銝脣% i3 K, J, U! b# K, D
<Ctrl><u> 閬蝒敺銝脣
% d. V2 T2 d; s! ^2 p+ I: m' z& @ <Ctrl><e> 閬蝒敺銝脖銵
% _# m$ ^: D0 E9 j! s <Ctrl><y> 閬蝒敺銝脖銵" s2 A& b+ r9 P
6 K4 n4 v2 g' D* J3.芷扎銴鋆賢靽格寞隞支蝝 (甇文桀頛撠雿輻)
+ R2 _/ z! J: O* v; a& n1 ? d(delete)c(change)y(yank)銝憿隞文 vi 銝剔隞斗澆綽$ B; H* C/ x7 U4 G- U6 r( e. x- S9 p
Operator + Scope = command$ c1 C; A: I' W
(蝞摮) (蝭)
& i3 F5 e" L5 o- W5 U 蝞摮嚗
" w6 b/ R$ N1 B/ Q d 芷斗隞扎芷方嚗雿撠芷方銴鋆賢啗園蝺抵5 D& E) P1 c( p7 e5 A9 Q3 c
y 撠鞈(摮蝯銵亙畾菔)銴鋆賢啁楨銵( m& s2 \; g& r$ X
p 曄蔭(put)隞歹 d y 雿輻具臬敺deleteyank鞈7 f( \. f# e0 \. u
曄蔭潭虜璅其蝵桐銵銝5 _, W& s& J# e# {8 C ]7 |
c 靽格(change)隞歹憿隡寮eleteinsert蝯芷支摮蝯$ Z4 W# ^$ d' i% S5 S
摮蝑銋鞈嚗銝行交圈菔
, t1 \! }/ g& z 蝭嚗" T( x0 k/ w: @8 I2 W+ y* M0 s
e 望虜璅其蝵株唾府摮銝脩敺銝摮0 r8 B% S+ K9 d g0 K* o
w 望虜璅其蝵株喃銝摮銝脩蝚砌摮
! }8 A% t! @8 u9 b7 S b 望虜璅其蝵株喳銝摮銝脩蝚砌摮
! b/ {# N9 {; \% T" `/ R3 P $ 望虜璅其蝵株唾府銵敺銝摮
% @ y* m& z d S# a 0 望虜璅其蝵株唾府銵蝚砌摮
: }* V& c# u" M/ f& X ) 望虜璅其蝵株喃銝亙蝚砌摮0 ~+ r# q- H2 T/ x! r" c3 [
( 望虜璅其蝵株唾府亙蝚砌摮
8 {) T5 W" E! v9 p) N { 望虜璅其蝵株唾府畾菔賜敺銝摮1 `/ |, h. v G7 `
} 望虜璅其蝵株唾府畾菔賜蝚砌摮; f9 u" M0 M! h$ w9 z
渲雿% R+ L' I+ L; V! b: H% |/ B
dd 芷斗渲6 ^4 R2 @" M# d% o, o1 v6 d
D 隞亥箏桐嚗芷斗虜璅敺銋摮+ z% M7 g4 E! |* e. X1 _
cc 靽格寞渲批捆6 E( a, B5 f$ D: s+ ?- ?
yy yank渲嚗雿踵虜璅刻府銵銴鋆賢啗園蝺抵3 V# z( j3 \ J& X) P' a' |
4 n1 Y) Z3 C; g [$ y! Y
4.芷方靽格5 M! ]% d: z0 e6 r, s$ A
x 芷斗虜璅刻府摮/ ^7 W1 r+ j0 F
X 芷斗虜璅其銝摮
. g4 \0 ~+ C- b dd 芷斗虜璅刻府銵
/ H. L/ \* |- v" s5 K4 X7 } r 冽交潭迨隞支敺摮隞(replace)皜豢典
0 f* z) q; _* A" R7 d! J 憒嚗 ra 撠皜豢典隞 a 隞銋
- n% z7 Q( X5 N+ n* n" S, B R 脣亙隞嚗游啜ESC箸迫
3 Q- x l7 Q* g! T* u6 i! ^8 G s 芷斗虜璅其摮嚗銝阡脣亥撓交芋撘游啜ESC7 h/ ?# W' ^! [' M
S 芷斗虜璅其閰脰鞈嚗銝阡脣亥撓交芋撘游啜ESC
$ J0 m3 {" U) ^7 e& S3 }: k
e) I; g8 z* K2 t; c9 I5.祉宏銴鋆
; B C. w! g" v4 H' ?/ p 拍牡elete put 隞文臬鞈祉宏銋桃5 D; T+ G% J& {' [
拍肘ank put 隞文臬鞈銴鋆賭桃4 C8 v& X4 u9 {7 X
yank delete 臬摰鞈銴鋆賢啗園蝺抵嚗 put 隞' x7 R9 M; M4 Z1 C) }
臬蝺抵抒鞈銴鋆賢啗W銝) c1 N1 p, a! ~2 V
靘嚗
9 ^) f) A/ k7 `, Q3 o, I3 d, K! | 祉宏銝銵 批刻府銵瑁 dd; p# N/ }3 J% i3 k, z$ v
扳虜璅蝘餉喟桃9 A7 q1 ?+ F8 u9 g4 x7 b* C7 b
批瑁 p
: N5 Y3 k6 l2 |- G) y r 銴鋆賭銵 批刻府銵瑁 yy9 u2 u( y+ b) ] T' I
扳虜璅蝘餉喟桃 L4 F ]5 ?% J% ]" }
批瑁 p3 t% ~) U- o0 o3 v
9 J7 v, l8 X+ c7 H# I, u# B7 p6.隞日銴
* p$ }% P% b- n* f9 G2 v( {5 }) z 冽隞斗芋撘銝哨臬冽隞文W乩詨 n嚗甇斗隞文雿銴瑁 n
) L" p" @/ A* p5 C4 S 甈∼* E4 [9 s/ w D$ y/ l0 u
靘嚗
7 j# \2 R3 D* E7 B; i ^: S 芷10銵 10dd
3 E/ F+ `' Y( k: ~" _ 銴鋆10銵 10yy
" w& ]/ f! G1 X: X6 v5 }5 e7 A 扳虜璅蝘餉喟桃$ r4 M& v' K* m
吠
y2 c! |2 R6 V; G 璅敺銝蝘10銵 10j
8 g. I. i' ^" n. T' |3 V+ z8 n$ |. {5 A: e U6 w( X" X1 s
7.瘨銝雿(Undo)0 d( Y( Y, t/ j& }, P0 h
喳儔瑁銝銝隞文批捆* }& Q w b3 L! C! r
u W儔敺銝隞支蝯
' J# W8 s5 L5 |. ^$ j9 v2 _ U W儔皜豢閰脰銋寡
r0 I, |, C0 }" I; n* S, o' m6 S1 `" p( s- e
8.撠
5 R: u8 H5 Z0 c6 \4 N$ K5 m% ^* V' i! Q 肖i銝剖舀撠銝摮銝莎雿踵虜璅蝘餉唾府
& O0 {- F7 U2 B' Y( I& o3 M& A, ^1 w3 v /摮銝 敺皜豢銋敺撠曇府摮銝脯9 n6 Y \) X N& a4 B
?摮銝 敺皜豢銋撠曇府摮銝脯 w1 E( }8 C3 Q4 ~" ^% i& b. J
n 敺銝蝜潛撠曆銝詨摮銝脯+ e8 F, H% X+ B, m! i
N 敺銝蝜潛撠曆銝詨摮銝脯1 j0 X2 N7 c; y1 ] t! d9 z9 w
2 @' v6 v2 Q/ _1 c! \
9.鞈
: s- f( R6 q' t# H J 亙乓撠皜豢其銝銝銵亥單虜璅閰脰敺U
5 p0 s1 j1 J" y! y 交銵鞈憭芷瑚漲臬嗅抵嚗芾撠皜豢蝘餉喳暺嚗脣亥撓交芋撘* r: I# X) O$ f* \% }7 y1 Z
(臬拍災i蝑隞)Enter喳胯
( |& g: J6 {/ o7 i/ n( y
& m4 {2 f8 @( G10.啣閮剖
+ N/ ~6 v3 d- T" U4 ]. m2 z 嚗setnu 閮剖鞈銵
; ^' J# l! D9 A/ @7 y 嚗setnonu 瘨銵閮剖1 M( i* Y' |' D1 b+ @
嚗setai 芸抒葬2 I a* \1 Y: S6 `
嚗setnoai 瘨芸抒葬) o' W' D4 G! Q; [; K" B( x% W# N
芸抒葬(automatic indentation)
0 }% i0 c# O* T7 N% T 函楊頛舀隞嗆蝔撘嚗圈閬抒葬瘜嚗嚗set ai單靘* I) O4 e4 V8 q: q( B' @- i- l: ^- _
抒葬踝其靘閫銋嚗
6 W3 x \1 S0 Q. G 听i test
2 P% I8 K7 ^( ~3 B, R! C/ U (脣亦楊頛航蝒敺)
; L+ U) v8 s% Q+ n# h3 O this is the test for auto indent
8 {, \; A& Y8 i* U* J4 @5 x3 O Tabstart indent 嚗set ai (閮剛芸抒葬)8 A) m j7 s1 G6 ]
Tabdata
* U0 m3 I8 P5 t3 N Tabdata; G8 T0 Z+ V4 j- _) T7 v. o
Tabdata 嚗set noai (瘨芸抒葬)
' |* o& F# f! I) v the end of auto indent.7 @ @7 s4 F/ \2 B5 |
扯酉嚗<Ctrl><d>臬芷扎Tab摮: ^2 P( x d0 T; m& K& s7 l
6 ]* B1 ]9 C! ]# r( e& B' _" p- n11.ex隞8 ]: \5 ]! I/ h
霈撖怨: n% E, J& a4 o- Z; ~1 H
嚗w 撠蝺抵鞈撖怠亦蝣銝准
+ E2 ^, o+ Q% ]. d2 q7 a; K 嚗10,20wtest 撠蝚10銵喟洵20銵鞈撖怠另est瑼獢
# l* {% [0 I7 m, A5 z 嚗10,20w>>test 撠蝚10銵喟洵20銵鞈系est瑼獢銋敺9 w) ~3 u. c( U1 L
嚗rtest 撠test瑼獢鞈霈亦楊頛舐楨銵敺
- b8 @/ h$ I3 u) S 芷扎銴鋆賢祉宏0 D5 J4 n$ i7 S- g; L' I; S
嚗10,20d 芷斤洵10銵喟洵20銵鞈! H( e" @. t$ E b- U
嚗10d 芷斤洵10銵鞈. i& g2 X, J4 K) S6 [) Q1 H! d
嚗%d 芷斗游蝺刻摩蝺抵
- P7 i3 u; b6 y" u6 c, A& r 嚗10,20co30 撠蝚10銵喟洵20銵鞈銴鋆質喟洵30銵銋敺; [$ @& ]3 W, _8 X+ _$ f
嚗10,20mo30 撠蝚10銵喟洵20銵鞈祉宏喟洵30銵銋敺
, z4 K+ E9 k0 o! ?" ?% i" a7 W 摮銝脫撠隞
2 b- t" S; W, R3 z0 { s(substitute)隞文舀撠銵蝭) w. }- F& C( r/ `; e( u+ h" i3 i
g(global)隞文舀撠游蝺刻摩蝺抵鞈0 A; u4 `% n9 f3 [
s隞支誑蝚砌皛輯雲閰脫隞嗥摮銝脩箏嗅隞撠鞊∴亥府銵詨皛輯雲閰脫
) h8 |* b; {' C# U 隞嗥摮銝莎銋賢隞蝚砌嚗交喳隞摮銝脣銝g詻. d% g2 U" \- e$ t* [2 s: f
嚗1,$s/old/new/g 撠瑼獢銝剜old寞new* c5 M7 F( }& O; Z8 G- O$ |
嚗10,20s/^/ / 撠蝚10銵喟洵20銵鞈X5蝛箇賬
4 Z% k5 I- o2 P( e 嚗%s/old/new/g 撠蝺刻摩蝺抵銝剜old寞new
( T3 H4 l% l9 N J( ?4 d
4 o+ t8 J$ P9 z7 n2 e8 B9 M( d: h) g12.W儔蝺刻摩鋡思葉瑞瑼獢: d; s* `) l7 H$ t
函楊頛舫蝔銝哨亦頂蝯梁嗆蝺銝剜瘀蝺抵鞈銝阡
$ d1 ]9 ^4 q+ j* J 鋡怠神蝤蝣嚗嗅摨血啁頂蝯梧瑁銝隞文喳臬敺拐葉瑕; d/ Y$ J7 r+ S* ]3 e) S, y# d _1 A
瑼獢批捆
2 v- n* l* M! _: {* C %vi -r filename
( y+ x( w$ A, Y0 f3 |0 K3 Y5 z. }7 y2 Z% x% c
13.蝺刻摩憭瑼獢* b1 o. I5 k- K) s4 q9 \) g2 }
vi鈭行靘蝺刻摩憭瑼獢踝寞憒銝嚗9 Y5 G6 G5 Q. a `
%vi file1 file2 ..0 N! j( s5 p" O
嗥洵銝瑼獢蝺其耨摰敺嚗臬拍具嚗w撠閰脩楨銵摮瑼嚗敺
( }0 _' x$ }% l/ R) I8 {" Y 拍 嚗n頛乩銝瑼獢
, \; V( t- n. d: a: L1 U5 Z$ r* L, U$ ?8 {9 P! l% V" s
:
# ~& \& J& c) }8 _1 U* o$ w
- ], h( ~- q! l5 P( u) X; M3 Jhttp://chunchaichang.blogspot.tw/2010/08/vim-s.html
! F1 \% a- B$ {7 S- x |
|