0

I sometimes like using splits. Both vertical and horizontal, depending on the files I'm looking at. When creating a split, vim automatically halves the available size of, in my case, a terminal emulator like mate-terminal.

However, if I change the window size of that terminal, vim keeps the size of each split as it was, which I agree is a sensible default. I'm looking for a command to force vim to redistribute the available size anew as if I had opened a new split. Looking at :help split I only see various ways to open a new split, not to rearrange existing ones.

2 Answers 2

2

You are using windows, not "splits", therefore :help split is irrelevant.

The closest to a "rearrange all existing windows" command would be :help ctrl-w_=, which is the first listed under :help window-resize.

You can tell Vim to execute that command when the terminal window (CLI Vim) or the GUI window (GVim) is resized with the following autocommand:

augroup AutomaticStuff autocmd! autocmd VimResized * wincmd = augroup END 

See :help autocommands and :help :wincmd.

1

Window movement commands like ctrl w J (and ctrl w [HJKL]) also resizes windows. This can be useful when you want to leave the vertical split as is and just reset horizontal split to be equal.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.