How do I make Vim equalize split windows only horizontally?
Answer
:set eadirection=hor
Explanation
If you use many splits, automatic equalization can feel disruptive when Vim resizes both height and width after layout changes. The eadirection option controls which dimension is affected when equalization happens (for example with equalalways behavior or CTRL-W =). Setting it to hor limits equalization to horizontal sizing decisions, which keeps vertical structure more stable.
How it works
:setupdates an optioneadirectionmeans "equalalways direction"hortells Vim to equalize windows in the horizontal direction only
In practice, this is useful when you maintain stacked windows with carefully chosen heights and still want convenient width balancing as files open and close.
Example
Consider a three-way layout where top/bottom context matters:
+---------------------------+
| test output |
+---------------------------+
| current source file |
+---------------------------+
| logs |
+---------------------------+
When a new split appears, full equalization may flatten the layout too aggressively. With:
:set eadirection=hor
Vim focuses equalization behavior on horizontal distribution, reducing vertical churn.
Tips
- Combine with
:set equalalwaysif you want automatic balancing after split changes - Use
:set eadirection=bothto return to default behavior - This option is especially helpful on wide monitors with many side-by-side panes