How do I stop running Vim macro

2020-07-01 09:10发布

问题:

I recorded a macro to a register and started it with too many repetitions. It takes way to much time to complete each macro.

How do I cancel/stop Vim executing macro? Is there a way by doing it without killing editor process?

Here are the steps I followed:

  1. Recorded macro to register 1
  2. I run it 1000 times: 1000@1
  3. Now waiting about 6 seconds to complete each macro.

回答1:

C-c works

Also, you can let it break on error. (which, I think, is the default). I sometimes temporarily do

 :se nowrapscan

to avoid "infinitely" looping over my buffer


Also, to speed up macro execution, make it silent:

:silent! norm 1000@q


标签: vim macros