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

How do you use a macro to remove consecutive duplicate lines?

Answer

qayy:+1\nif getline('.')==@0|d|else|+1|endif\nq

Explanation

Record a macro that yanks the current line and compares it with the next. If identical, delete the duplicate. Advanced use of Vim expressions.

Next

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