Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim: "extend" window into next window

Tags:

vim

window

Let's say I have this layout in vim:

+-----+-----+-----+
|     |     |     |
|  a  |     |     |
|     |     |     |
+-----+  c  |  d  |
|     |     |     |
|  b  |     |     |
|     |     |     |
+-----+-----+-----+

is it possible to end up with this layout:

+-----+-----+-----+
|     |     |     |
|  a  |  c  |     |
|     |     |     |
+-----+-----+  d  |
|           |     |
|     b     |     |
|           |     |
+-----+-----+-----+

like an "extend right" command ?

PS. Don't tell me to use ctrl-w J on b then ctrl-w L on d, my layout is actually more complex then this. I'm really looking for an "extend right" command if it exists.

like image 468
Ben Avatar asked Sep 19 '15 14:09

Ben


1 Answers

This is hard to implement as a feature since there can be a lot of edge case scenarios to consider, also why vim doesn't do this natively.

If you don't like the option of using ctrl-w J on b then ctrl-w L on d then the simplest approach would be to close the c split and then open a new vertical split on a and open the buffer / file within it that you desired.

like image 74
Dhruva Sagar Avatar answered Sep 23 '22 02:09

Dhruva Sagar