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

How do you record a macro that duplicates a line and modifies the copy?

Answer

qayyp:s/old/new/\nq

Explanation

Record a macro that yanks and pastes the current line, then substitutes text on the new line. Useful for generating variants.

Next

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