summary refs log tree commit diff stats
path: root/emacs
diff options
context:
space:
mode:
authorAlan Pearce2019-07-10 23:04:21 +0200
committerAlan Pearce2019-07-10 23:04:21 +0200
commitc0358d70a3715b1af00c0411237427fd8ca3d3a7 (patch)
treed498796b794f82c626568bc6e06e1689072e9b70 /emacs
parentd29a564b00f48b64ecbc695a59fa5f14828f977d (diff)
downloadnixfiles-c0358d70a3715b1af00c0411237427fd8ca3d3a7.tar.lz
nixfiles-c0358d70a3715b1af00c0411237427fd8ca3d3a7.tar.zst
nixfiles-c0358d70a3715b1af00c0411237427fd8ca3d3a7.zip
Emacs: split windows horizontally, never vertically
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/main.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el
index 51a397d4..8e66a8bc 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)