Sometimes I do a repetitive task via a macro, but it ends up too complicated and I make a mistake somewhere. Then when I try to execute the macro, everything happens at once and I can't see where I went wrong, so instead of trying to edit the macro I just attempt to re-record it (with variable success).

Is it possible to set the playback speed of a vim/neovim macro? The idea being that if the macro is executing at 1 command per second (or slower) then I can better tell what went wrong.

Note that I am not looking for answers like "just don't use a macro for complex tasks" or "just record the macro bit-by-bit" or "just record multiple simpler macros" or "just look at the relevant register and imagine what those commands would do".

2 Answers 2


You may be able to set the 'writedelay' option. This will delay refreshing the screen by the given number of milliseconds.

So try :set writedelay=50 and run your macro.

Note, that if you use statusline plugins or similar (which force a lot of redraws), this may get tedious (so you may want to disable this before setting that option).

  • 2
    That's brilliant! neovim users take note, you'll also need to set redrawdebug to line in order to see anything: :set rdb=line wd=100. Also note that (maybe for syntax highlighting?) neovim seems to redraw the entire screen every now and again, which causes the cursor to slowly step through every line top to bottom.
    – beyarkay
    Commented Aug 25, 2023 at 12:02

What you could do to achieve something like this is to convert your macro into another one that introduce 1 second delay between the operation using the 1gs operation or if in insert mode ^o1gs

e.g.: If you macro is: dwihello world^[b you could convert it into: dw1gsi^o1gshello world^[1gsb

Theoretically it should be possible to do that automatically in VimScript but I suspect it will be a very brittle function :-|

Remark: the solution is based on this answer.

  • 2
    TIL about gs, that's pretty neat. I'll leave the question open for a bit longer in case there's another way to do it, but will accept your answer if nothing else comes up.
    – beyarkay
    Commented Aug 24, 2023 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.