I use something like zoomwintab to zoom in/out of a single window view, using tabs to simulate the effect.
It exposes a toggle function to zoom in on a single window, and to zoom back out to the orginal layout.
If I'm zoomed in and I quit
(rather than toggle), I want to return to the original layout, but with that window removed.
To achieve this, I'm recording the unique window id the zoom originated from,
let origin_win = win_getid()
" ...zoom in... (elided)
let s:origin_wins[win_getid()] = origin_win
and using that to determine which window I need to quit in addition to the current one.
augroup Zoo
au!
au QuitPre * if s:zoomed_win_only() | call s:quit_origin() | endif
augroup END
func! s:quit_origin() abort
let og = s:get_origin()
if s:exists(og)
let i = win_getid()
call win_gotoid(og) | quit
call win_gotoid(i)
endif
endf
I'm very happy with it, but I think it could be improved if there was a way to quit a specific window by its id. That way I could avoid the need to switch to the origin window, quit it, and switch back to the zoomed window I'm about to quit.
Is there a cleaner way I might do this?