I have a popup / floating window open which is normally used for temporary jobs, like searching the code or opening a quick REPL. Is it possible to turn that into a regular buffer? While I have it open, it does not show up in :buffers
, so I can't just move it to another tab or open a split above the popup; it remains in the centre of my screen. In fact, if I move away using <C-W><C-J>
or similar, I can't even move back using the opposite direction, and have to find and plug in a mouse to get back into the popup!
My particular use-case is to keep the search results from fzf.vim's Rg command so that I can return to them after browsing some matches. However, this should apply equally well to any other uses of floating windows / popups.
I see that vim-floaterm allows you to store and then return to floating terminal buffers, with some hackery searching by index for buffers, but I don't fully understand why this logic is correct or necessary:
" find **one** visible floaterm window
function! floaterm#window#find() abort
let found_winnr = 0
for winnr in range(1, winnr('$'))
if getbufvar(winbufnr(winnr), '&filetype') ==# 'floaterm'
let found_winnr = winnr
break
endif
endfor
return found_winnr
endfunction
Can anyone explain the use of winbufnr
, and how to use this to move a popup, or implement generalized store / load behaviour of popups?
:h popup-buffer
... popups are very specialized and restricted buffers. While you might be able to bend them into submission it'll only be by chance not by design.