Is it possible in vim to close a window and specify which one will fill the remaining space?
Say having a “six-pak” layout and closing the top left window X I would like to set that bottom window (B) would expand and fill the space occupied by the closed window and not the one to the right (A):
----------------------- //Closing top left window X
| | | |
| X | A | |
| | | |
-----------------------
| | | |
| B | | |
| | | |
-----------------------
----------------------- //The desired result B is expanded upwards
| | | |
| | A | |
| | | |
| B |--------------
| | | |
| | | |
| | | |
-----------------------
----------------------- //Actual result
| | |
| A | |
| | |
-----------------------
| | | |
| B | | |
| | | |
-----------------------
EDIT
I am looking for a generic solution not necessarily closing the top left window. I would like to specify any adjacent window to fill the current window position. This could be closing the middle bottom one and specifying the right bottom one to expand.
Try these three steps:
Close the top left window.
:q
Move to the lower left window.
CTRL-W w CTRL-W w
Move the lower left window to the far left.
CTRL-w H
You could then record these commands to a register to save keystrokes, e.g.,