How do you use a macro to prepend line numbers to each line?
Answer
qaI1. <Esc>jq
Explanation
Start at line 1, record a macro that inserts 1. at the start, moves down. Then use :let i=1 | g/^/s/^/\=i.'. '/ | let i+=1 for proper numbering.
qaI1. <Esc>jq
Start at line 1, record a macro that inserts 1. at the start, moves down. Then use :let i=1 | g/^/s/^/\=i.'. '/ | let i+=1 for proper numbering.