Snippets and other bits

Widescreen emacs and vertical splits

Jun 6, 2021

On a widescreen monitor, especially the really wide ones, it’s nice to have only vertical splits. This snippet will give bias to vertical splits:

(defun my-split-window-sensibly (&optional window)
  "replacement `split-window-sensibly' function which prefers
vertical splits"
  (interactive)
  (let ((window (or window (selected-window))))
    (or (and (window-splittable-p window t)
             (with-selected-window window
               (split-window-right)))
        (and (window-splittable-p window)
             (with-selected-window window
               (split-window-below))))))

(setq split-window-preferred-function #'my-split-window-sensibly)

← Back to all articles