Merge pull request #1247 from jdnavarro/develop

Maximize window vertically/horizontally
This commit is contained in:
Henrik Lissner 2019-03-26 03:45:52 -04:00 committed by GitHub
commit ab616cfb95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 4 deletions

View file

@ -103,7 +103,7 @@ See `display-line-numbers' for what these values mean."
(save-buffers-kill-emacs))) (save-buffers-kill-emacs)))
;;;###autoload ;;;###autoload
(defun doom/window-zoom () (defun doom/window-maximize-buffer ()
"Close other windows to focus on this one. Activate again to undo this. If the "Close other windows to focus on this one. Activate again to undo this. If the
window changes before then, the undo expires. window changes before then, the undo expires.
@ -119,7 +119,7 @@ Alternatively, use `doom/window-enlargen'."
;;;###autoload ;;;###autoload
(defun doom/window-enlargen () (defun doom/window-enlargen ()
"Enlargen the current window to focus on this one. Does not close other "Enlargen the current window to focus on this one. Does not close other
windows (unlike `doom/window-zoom') Activate again to undo." windows (unlike `doom/window-maximize-buffer') Activate again to undo."
(interactive) (interactive)
(setq doom--window-enlargened (setq doom--window-enlargened
(if (and doom--window-enlargened (if (and doom--window-enlargened
@ -143,6 +143,24 @@ windows (unlike `doom/window-zoom') Activate again to undo."
(maximize-window)) (maximize-window))
t))) t)))
;;;###autoload
(defun doom/window-maximize-horizontally ()
"Delete all windows to the left and right of the current window."
(interactive)
(require 'windmove)
(save-excursion
(while (ignore-errors (windmove-left)) (delete-window))
(while (ignore-errors (windmove-right)) (delete-window))))
;;;###autoload
(defun doom/window-maximize-vertically ()
"Delete all windows above and below the current window."
(interactive)
(require 'windmove)
(save-excursion
(while (ignore-errors (windmove-up)) (delete-window))
(while (ignore-errors (windmove-down)) (delete-window))))
;;;###autoload ;;;###autoload
(defun doom/reload-font () (defun doom/reload-font ()
"Reload `doom-font', `doom-variable-pitch-font', and `doom-unicode-font', if "Reload `doom-font', `doom-variable-pitch-font', and `doom-unicode-font', if

View file

@ -95,11 +95,14 @@
"L" #'+evil/window-move-right "L" #'+evil/window-move-right
"C-S-w" #'ace-swap-window "C-S-w" #'ace-swap-window
;; Window undo/redo ;; Window undo/redo
(:prefix "m"
"m" #'doom/window-maximize-buffer
"v" #'doom/window-maximize-vertically
"s" #'doom/window-maximize-horizontally)
"u" #'winner-undo "u" #'winner-undo
"C-u" #'winner-undo "C-u" #'winner-undo
"C-r" #'winner-redo "C-r" #'winner-redo
"o" #'doom/window-enlargen "o" #'doom/window-enlargen
"O" #'doom/window-zoom
;; Delete window ;; Delete window
"c" #'+workspace/close-window-or-workspace "c" #'+workspace/close-window-or-workspace
"C-C" #'ace-delete-window) "C-C" #'ace-delete-window)

View file

@ -44,7 +44,7 @@
;;;###autoload ;;;###autoload
(defun +org-present|init-org-tree-window () (defun +org-present|init-org-tree-window ()
"Set up the org window for presentation." "Set up the org window for presentation."
(doom/window-zoom) (doom/window-maximize-buffer)
(let ((cwm-use-vertical-padding t) (let ((cwm-use-vertical-padding t)
(cwm-frame-internal-border 110) (cwm-frame-internal-border 110)
(cwm-left-fringe-ratio -10) (cwm-left-fringe-ratio -10)