How can I delete the values associated with all the registers in vim?
I found this snippet on the web:
function! ClearRegisters() let regs='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/-="*+' let i=0 while (i<strlen(regs)) exec 'let @'.regs[i].'=""' let i=i+1 endwhile endfunction command! ClearRegisters call ClearRegisters()
It almost works, but it puts an empty value into each register, rather than deleting the register. Crucially, that means that when you then use the
:registers command, all the registers are still present, which makes the display cumbersome (although it's worth noting that if you quit vim, and reload it, the registers are then fully emptied, even if
viminfo is set up to save them).
How can I fully delete all the registers, so that
:registers doesn't display them, and without needing a restart?