1

Let's say I have ten splits as follows:

|0|1|2|3|4|
|5|6|7|8|9|

I now try to reduce the width of split 1 to be able to increase split 3 quite a bit (whoever wrote that particular file, used fairly long lines).

My problem is that when I attempt to change the size of split 1 with Ctrl+w < , the extra space goes to split 0, and if I attempt to correct that by changing the size of split 0, the only split I can get to change is split 1. Similarly, changing the size of splits 2 or 3 only also affects split 4; changing split 4 only affects split 3. So in short, I fail in my attempts to move the divider located between splits 1 and 2.

How do I get around this? I have not yet attempted to get the mouse involved (would like to try to avoid that, if possible).

2
  • So to be more precise: I'm trying to resize existing windows/splits without having to close a bunch of windows and reopen them. Which perhaps would work, if I managed to perform the required :sp and :vs in the right order.
    – Persilja
    Apr 5, 2017 at 18:27
  • I can't reproduce this behaviour. My horizontal resize operations always move the divider to the right of the current window, regardless of what order I opened them in (except when that window is rightmost, obviously). Can you add a sequence of split operations that always results in a window layout that behaves like this for you, or is the issue more unpredictable than that?
    – Rich
    Jan 30, 2018 at 12:06

2 Answers 2

1

Prefix a number before the split command to reduce it to a desired number of rows or columns: e.g., :10sp or :20vsp

See also: :help sp

2
  • I'm not sure I understand how that would help. I am after all not trying to open new windows, but resize existing windows.
    – Persilja
    Apr 5, 2017 at 18:13
  • Sure, I could make an attempt to close existing windows and reopening them in the right order (there appears to be a difference if I do :sp before :vs versus the other order), whatever that "right order" actually is. (Oops, shouldn't have hit enter while typing here. Sorry for two comments instead of one)
    – Persilja
    Apr 5, 2017 at 18:22
0

As far as I understod you, all you have to do is:

  1. Go to split 1 Ctrl+w 10<
  2. Go to split 2 Ctrl+w 10<

Split 1 is now 10 columns smaller, and split 3 is 10 columns bigger.

What you do is he following:

Starting:

| 0 | 1 | 2 | 3 | 4 |

Decrease the width of split 1:

| 0 | 1| 2 | 3 | 4 |

The width you have taken from split 1 is now in split 2. So to restore split 2 to the original size, and to pass the extra width further to split 3, you have to decrease the width of split 2 by the same amount:

| 0 | 1| 2 | 3 | 4 |

Since you have writen that Ctrl+w < decreases split 0, it is possible, that you have to go the other way arround, and use Ctrl+w 10>on split 4

2
  • 1
    That result is not guaranteed. Doing Ctrl+w 10< on split 2 is not guaranteed to change the size of spit 3 - indeed, my problem was that when doing that, it would resize split 1 instead, going back to the initial configuration and leave split 3 alone. It seemed to have something to do with the order in which I had opened the splits - some appeared to be grouped together, such that all size changes took place within the group.
    – Persilja
    Aug 4, 2017 at 18:43
  • Yeah it has something to do with the order. But as I said, try to do Ctrl+w 10> on split 4. Aug 7, 2017 at 6:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.