O'Reilly logo

Mastering Vim by Ruslan Osipov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running macros across multiple files

If you wanted to replay a macro across multiple files, you can use (you guessed it) arglist. Arglist allows you to execute normal mode commands with :normal command. For instance, you could run a macro from register a, as follows:

:arg **/* .py:argdo execute ":normal @a" | update

Here, :normal @a will execute macro a in normal mode, and update will save the buffer contents. You'll probably want to use arglist with recursive macros.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required