From c0358d70a3715b1af00c0411237427fd8ca3d3a7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 10 Jul 2019 23:04:21 +0200 Subject: Emacs: split windows horizontally, never vertically --- emacs/.emacs.d/main.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'emacs/.emacs.d') diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 51a397d..8e66a8b 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -165,6 +165,21 @@ With two prefix arguments, write out the day and month name." ;;; Windows +(defun split-window-properly (&optional window) + (let ((window (or window (selected-window)))) + (or (and (window-splittable-p window) + ;; Split window vertically. + (with-selected-window window + (split-window-below))) + (and (window-splittable-p window t) + ;; Split window horizontally. + (with-selected-window window + (split-window-right)))))) + +(setq split-window-preferred-function #'split-window-properly + split-height-threshold nil + split-width-threshold 160) + (use-package eyebrowse :after (evil) :custom ((eyebrowse-new-workspace #'counsel-projectile-switch-project) @@ -284,6 +299,7 @@ With two prefix arguments, write out the day and month name." :custom ((global-magit-file-mode +1) (magit-section-visibility-indicator nil) (magit-diff-refine-hunk 'all) + (magit-display-buffer-function #'display-buffer) (magit-completing-read-function #'ivy-completing-read)) :config (progn (remove-hook 'magit-section-highlight-hook 'magit-section-highlight) -- cgit 1.4.1