So far, I managed to implement a function that adds a delay after "putting" each character contained in a register to the screen:
function! AnimateInsertion() abort " split contents of last modified reg in individual chars let s:line = split(getreg(v:register), '\zs') " iterate through each character for s:char in s:line sleep 100m exe 'normal!a'.s:char redraw endfor endfunction
However, this approach treats the contents of the register as a literal string. In other words, this implementation prints an 'i' instead of actually treating it as a command that makes Vim go into insert mode. How could I execute the contents of the register as commands (just like
@<reg> does) and add a delay after each command is executed?
UPDATE: I encountered this 3-year-old question yesterday. It asks pretty much the same as this one. Unfortunately nobody has been able to come up with a solution yet.