Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop running Vim macro

Tags:

vim

macros

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.
like image 389
BlueNile Avatar asked Sep 11 '13 20:09

BlueNile


People also ask

How do I stop a macro in Vim?

Use Ctrl-O to temporarily get into normal mode, the “q” to quit recording. This is the same thing you'd do if already in Insert mode and want to start recording a macro into register “a”; Ctrl-O, then “qa”.

How do I stop Vim from running?

In Normal Mode , you can also press ZZ or ZQ to quit Vim. Where ZZ is the same as :x and ZQ is the same as :q! .

What is Vim macro?

In Vim, a macro is a feature that allows you to record a sequence of commands that you use to perform a given task. You then execute that macro many times to repeat the same job in an automated way.


1 Answers

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
like image 133
sehe Avatar answered Oct 19 '22 02:10

sehe