This page looks plain and unstyled because you're using a non-standard compliant browser. To see it in its best form, please upgrade to a browser that supports web standards. It's free and painless.

修性不修命,萬劫陰靈難入聖; 修命不修性,猶有家財無主柄
Album | Blog | Comment | Profile | Control Panel
aquatower | 30 March,2009 13:58
Bookmark: HemiDemi MyShare Baidu Google Bookmarks Yahoo! My Web Del.icio.us Digg technorati furl Bookmark to:YouPush Bookmark to:你推我報

常用vi指令

輸入模式
i:(insert)游標前加入, o:(open)新增一行, a:(append)游標後加入

指令模式
(1)游標移動

h(左), j(上), k(下), l(右)
0(行首), $(行末), ^(行第一字元)
H(視窗第一列),M(視窗中間列),G(視窗最後列)

:(number) 直接指定列
ctrl+f(下捲一頁), ctrl+b(上卷一頁)

(2)刪除(d)、複製(y)
---------------------------------------------
運算子+範圍

運算子:
d(刪除), y(複製), p(貼上)

範圍:
w------>(游標到下一字串首) ps: 比e多一個空格
e---->(游標到字串尾)
a字串-->b字串

):(游標到下段句首), (:(游標到該段句首), 0:(游標到行首), $:(游標到行尾)
----------------------------------------------
yy:(複製行), dd:(刪除行), x:(刪除游標所在字元), X:(刪除游標前字元), u:(取消前一動作)
----------------------------------------------
ex:
dd(刪除) ---> 目的地 --> p(貼上), yy(複製) ---> 目的地 --> p(貼上)

搜尋:
:/(尋找游標後字串), :?(尋找游標前字串)

編輯:
:%s/old/new/g [ %全部緩衝區, old原字串, new取代字串, g整個檔案 ]
:10,20s/old/new/g [ 10,20(10到20行) ]
:10,20s/old/new/ [ 沒有g只取代找到第一個字串)


Comment

Trackback

Comment Permissions: Only members may comment. If you are not a PIXNET member, click here to sign up.