diff options
Diffstat (limited to '.emacs.d/lisp/init-windows.el')
-rw-r--r-- | .emacs.d/lisp/init-windows.el | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/.emacs.d/lisp/init-windows.el b/.emacs.d/lisp/init-windows.el index 2bf54a3..8b65eca 100644 --- a/.emacs.d/lisp/init-windows.el +++ b/.emacs.d/lisp/init-windows.el @@ -8,32 +8,10 @@ :bind ("C-x C-M-b" . ibuffer) :config - ;; From EmacsWiki - (defun toggle-window-split () - (interactive) - (if (= (count-windows) 2) - (let* ((this-win-buffer (window-buffer)) - (next-win-buffer (window-buffer (next-window))) - (this-win-edges (window-edges (selected-window))) - (next-win-edges (window-edges (next-window))) - (this-win-2nd (not (and (<= (car this-win-edges) - (car next-win-edges)) - (<= (cadr this-win-edges) - (cadr next-win-edges))))) - (splitter - (if (= (car this-win-edges) - (car (window-edges (next-window)))) - 'split-window-horizontally - 'split-window-vertically))) - (delete-other-windows) - (let ((first-win (selected-window))) - (funcall splitter) - (if this-win-2nd (other-window 1)) - (set-window-buffer (selected-window) this-win-buffer) - (set-window-buffer (next-window) next-win-buffer) - (select-window first-win) - (if this-win-2nd (other-window 1)))))) - (define-key ctl-x-4-map "t" 'toggle-window-split)) + (defcustom large-frame-width-threshold 500 + "Minimum width (in chars) to consider the frame large." + :group 'djm + :type 'natnum)) (use-feature winner :defer 5 @@ -68,6 +46,18 @@ (fullframe vc-annotate quit-window) (fullframe elpaca-fetch-all quit-window)) +(use-package transpose-frame + :bind (:map ctl-x-4-map ("t" . transpose-frame)) + :config + (defun transpose-large-frame () + "Trasnpose the window arrangement, if the frame is large. + +This is based on the frame width, with the threshold being customised using +`large-frame-width-threshold'." + (when (> large-frame-width-threshold (frame-char-width)) (transpose-frame))) + :hook + (cider-connected . transpose-large-frame)) + (use-package ace-window :diminish :config |