How do I stop Vim from auto-equalizing split sizes when opening or closing windows?
Answer
:set noequalalways
Explanation
When you work with carefully sized splits, Vim's default behavior can feel disruptive: opening or closing a window triggers an automatic rebalance. Setting noequalalways disables that behavior so your layout stays exactly as you arranged it. This is especially useful when you keep a narrow diagnostics split, a wide code window, and a small reference pane during long editing sessions.
How it works
equalalwaysis a global option that tells Vim to resize all windows after split open/close events.:set noequalalwaysturns that automatic rebalancing off.- Your current window sizes are preserved unless you explicitly resize them.
- You can still rebalance on demand with
<C-w>=when you actually want equal sizes.
Example
Suppose your layout is tuned like this:
| code (wide) | logs (narrow) |
| | |
|----------------------------|---------------|
| quickfix (short height) |
With default settings, closing logs may cause Vim to redistribute widths and heights automatically. After:
:set noequalalways
closing or opening a split no longer forces a rebalance, so the remaining windows keep your manual proportions until you change them.
Tips
- Use
<C-w>=to equalize temporarily, then continue withnoequalalwaysenabled. - Pair with
:set winminheight=0and:set winminwidth=0if you want tighter control over how small utility windows can shrink. - If you only want this behavior in specific workflows, toggle it with quick mappings or project-local config.