Repeat vim macro to end of buffer

I want to run a macro that I just wrote in register " x " on every single line of the open buffer, from my cursor to the end of the buffer, in vim. How to do it?

I know that I can play the macro n times:

 15@x 

... or just hold @ until I get to the last line, but I just want to press a few keystrokes and do it.

Thanks in advance.

+63
macros vim
Aug 18 '09 at 5:28
source share
5 answers

Personally, I would do

 VG:normal @x 

Edit: changed the case to the one you specified.

+75
Aug 18 '09 at 12:26
source share

You can do (in command mode)

 :%normal @x 
+50
Aug 18 '09 at 5:39
source share

make a recursive macro:

 qa@aq 

Example:

 qa0gUwj@aq 

This will be the UPCASE first word from the current line to the end of the file with one @a. But make sure that "case is empty:

 let @a="" 
+17
Aug 18 '09 at 5:34
source share

999999@x if you do not have a very large buffer ...

+5
Aug 18 '09 at 5:31
source share

From the vim wiki, abridged version: qqqqq to write the @qq macro to complete the @q write to execute it (and will work until the end of the file)

0
Apr 04 '14 at 19:04
source share



All Articles