简体   繁体   English

重放vim宏直到缓冲区结束

[英]replay a vim macro until end of buffer

I want to run a macro I just recorded in register " x " on every single line of an open buffer, from my cursor to end of the buffer, in vim. 我想在一个开放缓冲区的每一行上运行一个我刚刚记录在寄存器“ x ”中的宏,从我的光标到缓冲区的末尾,在vim中。 How do I do that? 我怎么做?

I know I can replay the macro n times: 我知道我可以重播宏n次:

15@x

...or just hold down @ until I reach the the last line, but I want to just hit a few keystrokes and be done with it. ...或者只是按住@直到我到达最后一行,但我想点击几下击键并完成它。

Thanks in advance. 提前致谢。

Personally I would do 就我个人而言

VG:normal @x

Edit: changed register to the one you specified. 编辑:将寄存器更改为您指定的寄存器。

你可以做(​​在命令模式下)

:%normal @x

make recursive macro: 制作递归宏:

qa@aq

ex: 例如:

qa0gUwj@aq

It'll UPCASE first word from current line to the end of file with single @a. 它将使用单个@a UPCASE从当前行到文件末尾的第一个单词。 But make sure "a register is empty: 但请确保“寄存器为空:

let @a=""

999999@x ,除非你有一个非常大的缓冲区......

从vim wiki,缩短版本:qqqqq记录宏@qq完成记录@q执行它(并将运行到文件末尾)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM