Does any kind of :call yank(register_name, "string") API exist in vim? Or at least :yank register_name "strings" - I can't find any way to yank in vimscript without modifying a VIM buffer.

  • Are you talking about registers or buffers?
    – romainl
    Apr 3 at 5:28
  • @romainl buffers Apr 3 at 11:57
  • Not sure how buffers are involved, here.
    – romainl
    Apr 3 at 13:24
  • @JoL yeah, that sort of makes sense but also not really. Color me puzzled.
    – romainl
    Apr 3 at 13:43
  • @romainl because the only way I know how to yank text is to put it in a buffer and then use y or :yank Apr 3 at 14:13

1 Answer 1


:help setreg()

It's precisely :call setreg(register_name, "string")

Your Answer

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

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