Creating vim split window with arbitrary content

What: Create a split window in Vim with arbitrary content
Why: Displaying information easily along text your are editing
How: Use Vimscript

A simple Vimscript script

Create a file test.vim with the following content. It defines a function which creates a new buffer, adds text to it and show it in a split window on the right.

function! test#test()
  let buffernum = bufadd("")
  call bufload(buffernum)
  call setbufline(buffernum, 1, "Hey ho")
  execute "vertical rightbelow sb " . buffernum

Use the defined function

There are multiple ways, the function can be used. You can create a plugin (see or call the function from within Vim:

:source test.vim
:call test#test()