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

How do you record a macro to toggle boolean values (true/false)?

Answer

qa/true\|false\ncgn<C-r>=@"=='true'?'false':'true'\n<Esc>q

Explanation

Record a macro using cgn with an expression register to toggle between true and false. Advanced use of expression evaluation.

Next

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