This little plugin eases working with windows in Vim. Put it in your plugins dir.
It provides 4 functions:
WMFocusMasterWindow
: focuses the topmost-leftmost windowWMMarkWindowSwap
: marks the current window for a later swapWMDoWindowSwap
: exchanges current window with marked windowWMSwapWithMasterWindow
: exchanges current window with master windowWMReStack
: rearranges all the windows in a tiled layout with the current one as master
You can map them as indicated in the comments at the end of the file.
Arrows indicate current window
+---------+---------+
| | |
| | B |
| | |
| > A < +---------+
| | |
| | C |
| | |
+---------+---------+
:WMMarkWindowSwap
<Ctrl-w> l
+---------+---------+
| | |
| | > B < |
| | |
| A +---------+
| | |
| | C |
| | |
+---------+---------+
:WMDoWindowSwap
+---------+---------+
| | |
| | > A < |
| | |
| B +---------+
| | |
| | C |
| | |
+---------+---------+
<Ctrl-w> j
+---------+---------+
| | |
| | A |
| | |
| B +---------+
| | |
| | > C < |
| | |
+---------+---------+
:WMSwapWithMasterWindow
+---------+---------+
| | |
| | A |
| | |
| > C < +---------+
| | |
| | B |
| | |
+---------+---------+
An example of WMReStack
:
+---------+---------+
| | C |
| A |---------|
| | > D < |
|---------+---------+
| | |
| B | E |
| | |
+---------+---------+
:WMReStack
+---------+---------+
| | A |
| |---------|
| | B |
| > D < +---------+
| | C |
| |---------|
| | E |
+---------+---------+