I often use the <C-w>_
and <C-w>|
commands in Vim to maximize the current pane to fill the entire window (I have it keymapped to <C-w>0
).
And I've recently started using a tiling window manager, which means I sometimes find myself "moving" terminals into smaller or larger sections of the screen.
What happens is, say I have a vim instance in the lower right portion of my screen, with the current pane "maximized" to full view.
If I set that "tile" with the vim instance to be the active tile, it will move it to the main tile which takes up, say, 65% of the left side of the screen. This means the entire vim window itself now takes up a larger width and height and because of that, the active pane is no longer "fullscreen" based on this adjustment. Which means I need to rerun the <C-w>0
command in order for it to "recalculate" the pane dimensions so it fills up the now larger window space.
How could I have this done automatically? Maybe something to the effect of:
Upon window resize, if the active pane had previously been maximized, re-run the maximize command. Similarly, if the <C-w>=
had been previously ran, then re-run the resize all panes to be equal command.
Maybe it could tie in somehow to Vim's VimResized
autocommand?
http://vimdoc.sourceforge.net/htmldoc/autocmd.html#VimResized
Thanks in advance for any help or pointers!
EDIT: I've started reading about VimScript, will look into writing my first Plugin to hopefully address this need :)
:only
? I use it all the time to “maximise” a window, although it has the difference that you can’t as easily recreate the previously split files so may or may not help your workflow.:only
, but like you said, I don't use it often because I usually want to keep the ability to quickly restore the "minimized" panes. Thanks for offering though! :)