Is there some way to resize windows without using the mouse, such that I can control which border moves?

It seems like it's ordinarily the bottom border or right border that moves, relative to the window my cursor is in. I've found some cases where this is not the case (for example, expanding the vertical size of window 3 in the image below causes its top border to move up).

In the image below, I am trying to make window 5 larger by moving its top border up. However, I am not sure how to do this without using the mouse. Expanding the size of window 5 (<c-w>+) causes its bottom border to move down (as opposed to having window 5's top border move up). Shrinking the size of windows 3 or 4 (<c-w>-) causes their top borders to move down (as opposed to having window 5's top border move up).

(note: the window number labels used here don't correspond to the actual Vim window numbers)

enter image description here

2 Answers 2


It's decided by which kind of split they belong to.

You can tell the split type by the cross, if it's a |, then it's two cols, each col has two rows, if it's blank, then it's two rows, each row has two cols, they are quite different.

Window 1 and window 3 belong to the same col, if you resize them vertically, only the bar1-3 moves, if you try to resize them horizontally, they can't do it, they have to hand the job to their parent, their parent window13 share a row with window24, so bar13-24 moves.

Window 5 , window 6, and parent of window13 and window24 belong to the same col, when you resize window5 vertically, bar5-6 moves, it's the same as having 3 horizontal splits, vim prefer to move the bar below current window unless it's the bottom window.

If you want to move top bar of window 5, you have to make sure window 3 and 4 share the same row, so when you resize one of them vertically, their parent will move the top bar of window 5.

Another interesting thing is the "same" layout will give you different window number:

If you split your window into two rows, each row has two cols. The right top window has window number 2.

If you split your window into two cols, each col has two rows. The right top window has window number 3.

Siblings are counted before cousins.


If you're using vim>=8.2.4052, more specific control over which borders will move is provided by win_move_separator and win_move_statusline.

If your version of Vim has this functionality, echo exists('*win_move_statusline') will output "1".

Window 5's top border can be moved up by moving window 3's or window 4's bottom border with win_move_statusline. The first argument should be the Vim window number for the window labeled 3 or 4 in the image above, and the second argument should be a negative integer representing how many lines to move up the border.

Your Answer

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

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