在短时间内掌握VIM命令精髓。。

1066阅读 0评论2010-04-29 maxxfire
分类:LINUX

VIM中大部分命令的通用模式:
(number)(command)(text object)

其中:
number :执行次数
command :命令
text object :位置

具体如下:
命令
h …move left
l …move right
j …move up
k …move down
d …delete the characters from the cursor position up the position given by the next command (for example d$ deletes all character from the current cursor position up to the last column of the line).
c …change the character from the cursor position up to the position indicated by the next command.
x …delete the character under the cursor.
X …delete the character before the cursor (Backspace).
y …copy the characters from the current cursor position up to the position indicated by the next command.
p …paste previous deleted or yanked (copied) text after the current cursor position.
P …paste previous deleted or yanked (copied) text before the current cursor position.
r …replace the current character with the newly typed one.
s …substitute the text from the current cursor position up to the position given by the next command with the newly typed one.
. …repeat the last insertion or editing command (x,d,p…).

位置
text object.png
0 …first column of the line
^ …first non-blank character of the line
w …jump to next word
W …jump to next word, ignore punctuation
e …jump to word-end
E …jump to word-end, ignore punctuation
b …jump to word-beginning
B …jump to word-beginning, ignore punctuation
ge …jump to previous word-ending
gE …jump to previous word-ending, ignore punctuation
g_ …jump to last non-blank character of the line
$ …jump to the last character of the line


举例:
Change     Delete        Copy          from Cursor to ...
cH           dH            yH            top of screen
cL           dL            yL            bottom of screen
c+           d+            y+            next line
c5|          d5|           y5|           column 5 of current line
2c)          2d)           2y)           second sentence following
c{           d{            y{            previous paragraph
c/pattern   d/pattern  y/pattern         pattern
cn           dn            yn            next pattern
cG           dG            yG            end of file
c13G         d13G          y13G          line number 13
上一篇:电磁波对人体的危害
下一篇:一个信号处理输出问题。。