How do you set a register programmatically in Vim?
Answer
:call setreg('a', 'text')
Explanation
Use setreg() to set register contents from Vimscript. The third argument controls type: v (characterwise), V (linewise), <C-v> (blockwise).
:call setreg('a', 'text')
Use setreg() to set register contents from Vimscript. The third argument controls type: v (characterwise), V (linewise), <C-v> (blockwise).