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

How do you record a macro to format phone numbers with dashes?

Answer

qa0f lll i-<Esc>llli-<Esc>jq

Explanation

Record a macro that positions the cursor in a 10-digit number and inserts dashes at positions 3 and 6 to create the format xxx-xxx-xxxx.

Next

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