Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Close a split window in Vim without resizing other windows

Tags:

vim

split

window

If I have a Vim window open with 2 splits in it (3 total buffers visible) and I've adjusted the viewport of each split, then I close one buffer, the other two buffer's viewport's are automatically resized.

Is there a way to maintain or at least better scale the split when I close a buffer?

1) Vim window with three splits, custom size:   +---+-------+---+   |   |       |   |   | 1 |   2   | 3 |   |   |       |   |   +---+-------+---+ 2) Close buffer 3, splits are resized to "best fit":   +-------+-------+   |       |       |   |   1   |   2   |   |       |       |   +-------+-------+ 3) I want it to stay like this, resize only adjacent buffer:   +---+-----------+   |   |           |   | 1 |     2     |   |   |           |   +---+-----------+ 
like image 896
matpie Avatar asked Jan 28 '09 00:01

matpie


People also ask

How do I switch between split screens in Vim?

To move between splits first press Ctrl-w (I remember this by Control Window, I'm not sure what the official mnemonic is) Then press a directional key to move the cursor to the split you're interested in. Directional key could be the arrows or my preferred home row method.

How do I resize a Vim window?

To increase a window to its maximum width, use Ctrl-w | . In Gvim and vim in terminals with mouse support, it is also possible to use the mouse to resize a window. Simply grab the statusline at the window border and drag it into the desired direction.


1 Answers

set noea 

In other words:

set noequalalways 

See equalalways in the Vim documentation.

like image 77
strager Avatar answered Sep 23 '22 01:09

strager