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

How do you record a macro to convert 4-space indentation to 2-space?

Answer

qa:s/^ / /\njq

Explanation

Record a macro that substitutes leading 4-space indentation with 2 spaces on each line. Apply across the file to change indentation style.

Next

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