I have a function which opens a new window containing the results of a script
function! MyFunc()
bo new
se buftype=nofile
silent! exec "r! sh MyScript.sh "
endfunction
I’d like to identify this specific window so that I can call my function multiple times and use the same window each time rather than opening a new window.
something like
if exists(myWindow)
use myWindow
else
bo new
endif
Ok I think this might work… but… tread carefully because I am no Vim expert.
When you create the window the first time you can save it in a global:
and subsequently you can check to see if that buffer exists:
Setting “swb=usetab” will mean that when
sbufswitches to the buffer, it will go to whatever window/tab it is currently open in, if it is open. I don’t like setting swb globally like that, just for one sbuf call. Anyone know a better way?