Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change split orientation of 2 of 3 panes in vim?

Tags:

vim

It's clear how I would go about changing the orientation from a vertical split to horizontal with 2 panes, but I'm curious if it's possible to do it when I have 3 or more panes. Consider the following window setup:

+-----------------+
|Nerd |   |   |   |
|Tree | 1 | 2 | 3 |
|     |   |   |   |
+-----------------+

So, in this setup, you can see I'm focused on 3 vertically split panes. However, I would like to "rotate" 2 and 3 to use a horizontal split instead, thus resulting in something like the following:

+-----------------+
|Nerd |     |  2  |
|Tree |  1  |-----|
|     |     |  3  |
+-----------------+

Is something like this possible?

like image 897
naivedeveloper Avatar asked Oct 23 '25 07:10

naivedeveloper


2 Answers

  1. focus 2 then :hide
  2. focus 3 then :sp 2 (2 here should be filename, or :sb (2's buf number) )

demo:

enter image description here

like image 197
Kent Avatar answered Oct 24 '25 21:10

Kent


In each window, CTRL-W J will move it to a horizontally split window at the bottom. Then CTRL-W H on the NERD Tree window to move it vertical left.

I have not found a better way, unfortunately. This method scales very poorly.

like image 37
Ben Avatar answered Oct 24 '25 23:10

Ben



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!