执行 .
会重复上次更改。执行 2.
会重复上次更改两次。
但是想象一下我想在最后一个更改之前重复更改。我如何在 Vim 中执行此操作?
最佳答案
不认为可以,请参阅 :help 。
但是,您可以做的是为您的编辑录制宏,您有很多寄存器可供选择{0 -9a-zA-Z"}
(大写以追加)。
然后使用例如@u
表示编辑 1,@t
表示编辑 2,依此类推。
来自Best of VIM Tips的关于录音的重要提示
" Recording (BEST TIP of ALL)
qq # record to q
your complex series of commands
q # end recording
@q to execute
@@ to Repeat
5@@ to Repeat 5 times
qQ@qq : Make an existing recording q recursive *N*
" editing a register/recording
"qp :display contents of register q (normal mode)
<ctrl-R>q :display contents of register q (insert mode)
" you can now see recording contents, edit as required
"qdd :put changed contacts back into q
@q :execute recording/register q
查看这些以获取更多重复提示:
:& last substitute
:%& last substitute every line
:%&gic last substitute every line confirm
g% normal mode repeat last substitute
g& last substitute on all lines
@@ last recording
@: last command-mode command
:!! last :! command
:~ last substitute
:help repeating
关于vim - 如何重复 Vim 中的最后 n 个更改?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6644141/