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
endfunc
Use the defined function
There are multiple ways, the function can be used. You can create a plugin (see https://learnvimscriptthehardway.stevelosh.com/chapters/41.html) or call the function from within Vim:
1 2 | :source test.vim :call test#test() |