They may seem a bit complex but are quite simple. Basically you just record your editing movements and play it back.
How macros work: press q x to record and q to end. Then repeat with @ x, where x is the name of the macro you want to use (you can have several macros). Anything you do will be played back. That's it... Conceptually simple.
A nice trick is to record a macro for a single line and place the cursor on the start of the next line at the end of the recording. This way it's possible to operate upon large blocks of text in a similar way by just repeating the macro. The key then is to use generic movements like "go to the beginning of line" (^), "go to the end of line" ($), "skip word" (w), etc.
As a silly toy example, if you have a list of strings in a text file, you can turn it into a list of quotes with (from the top of my head):
qx<Home>i"<Esc>$i<Right>",<Down><Home><Esc>q
(Record macro, go to beginning of line, insert mode, write a quote, exit insert mode, go to end of line, insert mode, move right, write a quote and a comma, move down to next line, move to the beginning of line, exit insert mode, end macro recording)Then to process 100 lines, you'd do:
100@x
That turns these:
alpha
bravo
charlie
delta
...
into "alpha",
"bravo",
"charlie",
"delta",
...
If you have hundreds of lines of that you'll start to appreciate the easy automation.I use macros to do drive-by mass-edits without resorting to sed, scripting, regular expressions etc. since the cognitive load of those is higher for me.
Edit: formatting