There are several questions similar to this one. I have read them all and they don't provide an answer for my scenario. I want emacs to prefer vertical splits (splitting windows into left and right parts) over horizontal ones, even if both horizontal and vertical splitting is possible. This is what the manual says:
The split can be either vertical or horizontal, depending on the variables split-height-threshold and split-width-threshold. These variables should have integer values. If split-height-threshold is smaller than the chosen window's height, the split puts the new window below. Otherwise, if split-width-threshold is smaller than the window's width, the split puts the new window on the right.
So if both split-height-threshold
and split-width-threshold
are smaller than the window's width and height, emacs will perform a horizontal split. I want the opposite. If both thresholds are smaller, perform a vertical split.
One way to achieve that is to set split-height-threshold
to nil
, but I don't like that because it disables horizontal splitting completely.
I have looked at the split-window-sensibly
function, but I'm not good enough at elisp to write my own my-split-window-sensibly
function that works like I want.