vi -R filename /*readonly
view filename /*readonly
0 /*begin at the head of a line
$ /*begin at the tail of a line
w /*go to next word
b /*go back to the previous word
W/B /*do not count the punctuation
( /*the begian of this sentense
) /*the begian of next sentense
:x /*put the cursor to the specific line
Ctrl+G /*the get the position of the cursor now
ZZ/:x /*the same as :wq
Ctrl+G /*the get the position of the cursor now
:e! /*reopen the file without your modification
dw /*remove the character until the begian of next word
D /*remove the character until the end of the line
cc /*remove the whole line then go to insert mode
cw
r
R
s
S /*remove the whole line then go to insert mode
yw
U /*only recover the current line
:!command /*for example: :!ls
s/misspelled/correct spelled /*only replace the fist object in the line
s/misspelled/correct spelled/g /*replace all the objects in the line(globally)
x,ys/characters to be replaced/what to replace with /*x,y is the line number
x,ys/characters to be replaced/what to replace with/g /*x,y is the line number
1,$s/mispelled/correct spelled/g /*replace all the mispelled word in the file
1,$s/mispelled/correct spelled/gc /*confirm the every replaced word
1,$s/mispelled*/correct spelled/gc
1,$s/\*/hello/g /*use hello to replace all the * in the file
1,$s/1,$s/>the/none/g
阅读(1467) | 评论(0) | 转发(0) |