Neovim

Editing macros in neovim

Your macros deserve a second change

April 22, 2025

Have you ever typed out a long, complicated macro in Neovim, only to make a mistake at the very end?

When you record a macro in Neovim, it’s automatically stored in one of Neovim's registers. This means you can view, yank, edit, and paste macros just like any text in your buffer. You can quickly see the contents of all registers with :registers.

Preview :registers

For example, let’s say you recorded a macro in register q. You can access it like this:

"qp

Now, you can edit the macro just like regular text and once you’ve made your changes, yank it back into the register. Position your cursor on the line and do:

"qyy

Tipp

To make editing cleaner, open a new scratch buffer :enew and work on your macro there. Once you’re happy, yank it back to the register.

Share