VIM macros

VIM macros are very handy for repetitive tasks. For example, when you are resolving lots of changes between two files.

So assuming the commands that are being performed are:

  1. Go to the next difference, ]c
  2. Copy from the other pane, do, or put to the other pane, dp
  3. Repeat…

Though since you won’t know what to do about the next difference until you see it, it is probably better to swap the command order…

So you’d record the macro (live) using the q command to register a


Now that you have the macro recorded, use @a to run the macro, and @@ to repeat the macro. If you can see ahead, save yourself some repetitive typing and repeat the command (e.g. 3@@).

To save/load the macro, see the URL; I haven’t needed it yet…


138 Words

2018-06-05 17:12 +0000