首页 > 代码库 > vim摘要
vim摘要
The "." command is one of the most simple yet powerful commands in Vim. It
repeats the last change. For instance, suppose you are editing an HTML file
and want to delete all the <B> tags. You position the cursor on the first <
and delete the <B> with the command "df>". You then go to the < of the next
</B> and kill it using the "." command. The "." command executes the last
change command (in this case, "df>"). To delete another tag, position the
cursor on the < and use the "." command.
f<
df>
f<
.
f<
.
find first <
delete to >
find next <
repeat df>
find next <
repeat df>
To <B>generate</B> a table of <B>contents ~
???>
??>
?????????>
???>
?????????????>
??>
The "." command works for all changes you make, except for the "u" (undo),
CTRL?R (redo) and commands that start with a colon (:).
Another example: You want to change the word "four" to "five". It appears
several times in your text. You can do this quickly with this sequence of
commands:
/four<Enter>
cwfive<Esc>
n
.
n
.
find the first string "four"
change the word to "five"
find the next "four"
repeat the change to "five‘
find the next "four"
repeat the change
etc.
================================
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。