In Vim, is it possible to “move” a window to the left or right? Eg, similar to <c-w> r
or <c-w> x
, but left/right instead of up/down?
For example, if I've got this layout:
+---+---+---+
| | +---+
| A +---+---+
| | | |
+---+---+---+
I'd like to turn it into this:
+---+---+---+
| | +---+
+---+ A +---+
| | | |
+---+---+---+
Which is difficult/annoying to do with <c-w> {H,J,K,L}
.
Best Answer
Ctrl w gives you the "windows command mode", allowing the following modifiers:
Ctrl w + R - To rotate windows up/left.
Ctrl w + r - To rotate windows down/right.
You can also use the "windows command mode" with navigation keys to change a window's position:
Ctrl w + L - Move the current window to the "far right"
Ctrl w + H - Move the current window to the "far left"
Ctrl w + J - Move the current window to the "very bottom"
Ctrl w + K - Move the current window to the "very top"
Check out
:help window-moving
for more information