11

I jot notes in a tiny split window (buffer) regularly:

<C-W>s
:enew
:res 5
... jot jot...

When I create a new horizontal split in the same tab, that little window resizes, as if doing <C-W>=, which brings me to the question:

Can I keep a split from resizing?

2 Answers 2

12

If you're like me, and came across this question when hoping to make a particular window have a fixed width (or height) without disabling 'equalalways' and avoiding Ctrl-W=, you should be aware of 'winfixwidth' (or 'winfixheight'):

'winfixheight' 'wfh'    boolean (default off), local to window
    Keep the window height when windows are opened or closed and
    'equalalways' is set.  Also for CTRL-W_=.  Set by default for the
    preview-window and quickfix-window.
    The height may be changed anyway when running out of room.

This is useful, for instance, in terminal windows; I use setl wfw in all of my vertical term-splits.

2
  • This should be the accepted answer, because it more directly answers the question. Jul 8, 2021 at 14:48
  • I guess since the command is local to window there is no need to use setl, so set wfw would also be fine
    – Hobber
    Sep 17, 2021 at 7:58
8

If you read the doc for the command you use you will see :h CTRL-W_S:

Reduces the current window height to create room (and others, if the 'equalalways' option is set, 'eadirection' isn't "hor", and one of them is higher than the current or the new window).

So you can read :h 'equalalways':

When on, all the windows are automatically made the same size after splitting or closing a window. This also happens the moment the option is switched on. When off, splitting a window will reduce the size of the current window and leave the other windows the same.

So adding this to your vimrc should resolve your issue:

set noequalalways
0

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.