I'm writing a plugin that often needs to write text to specific buffers. My current solution is to make the script execute normal commands that open a split with the buffer, write the text and then close it thus returning to the previous split.

Although this is fast enough for the intended purposes, it feels a bit dirty. Is there a more clean/efficient way to do this?

1 Answer 1


Check vim help for the following entries:

  • :h function-list
  • :h setbufline() -- what you probably need
  • :h getbufline() -- and also this.
  • :h appendbufline() -- and this.

Your Answer

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