Macro is essentialy a set of instructions which you "record" (just like you record your voice for example) and then you run it (play that record). The thing is you can run them as many times you want in a row what makes them very powerful. So how to do it?
You start in
NORMAL mode. To start recording a macro you
q key and then a key from
which you want to macro store under. Yes, you can record
multiple macros and then run them arbitrarily. So let's say
you name your macro
a so press
a key. You will see in right bottom
conrner that vim tell you you are "recording @a" (
symbol for macro).
From now whatever sequance of keys you press is recorded until
you get backto
NORMAL model (
and then pres
q to stop recording your macro.
So now you can create macro with any functionality.
Last thing you need to know is how to run such macro. If you
named your macro
a you can run it with
@ key and then
stands for macro and
a key for the macro name.
You can also re-run your last maro run with
@@ key. But
probably the most interesting thing is to run a macro
multipletimes in a row. You can do that in classic vim way
where you press
10@d which means runs 10 times my macro
For more info about macros head to the official documentation page. I hope macros serves you good.