Editing Vim Macros

Vim macros are great. If you’re not familiar with them, there’s a great Vim tips article.

Something cool I’ve discovered is that you can edit macros. This is helpful if you accidentally mess up a macro recording, or decide you need to tweak it in some way.

If you recorded a macro to register a, you can paste its contents into the current document with "ap. From there, you can edit the macro and then yank it back into the a register with "ay

This also makes it easy to paste your macros into your vimrc for future use.

1
2
" delete first word of line
let @d='0dw'
I am now accepting new clients for part-time consulting and software development projects. Learn more
Vim

I haven't configured comments for this blog, but if you want to get in touch, you can find me on Twitter