I can create a simple macro in vi(m) to add the letter b at the end of every line:
q b $ a b Esc j q
q start recording macro
b name the macro
$ jump to end of current line
b the letter b
Esc back to command mode
j one line down
q end recording
When I have a text file, and I execute 20@b, then the letter b is added to 20 lines.
When there are less than 20 lines, then I would expect this macro to add multiple b's to the end of the last line. But it does not. When you type the commands in the macro yourself, then it does add multiple b's.
How can you explain this behaviour ?
Is there an easier way to add a b to every line (in vim) ?