I have a function that animates the insertion of the contents of the last modified register at the cursor's location as if someone was typing it:
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
When I run this function with the text
Try me inside the last modified register, the following text gets inserted:
T r y m e
Evidently, there is a problem with the
exe 'normal!a' s:char line. Why are the spaces between the letter being inserted? What is the proper way of doing this?