vimtricks.wiki Concise Vim tricks, one at a time.

How do you use a macro with the expression register to generate a number sequence?

Answer

:let i=1\nqao<C-r>=i\n<Esc>:let i+=1\nq

Explanation

Use a counter variable with the expression register inside a macro. Each iteration inserts the current value and increments. Creates sequences.

Next

How do you yank a single word into a named register?