Add doom/window-enlargen (replace C-w o bind)

This commit is contained in:
Henrik Lissner 2017-05-19 03:00:27 +02:00
parent 34d1364c5b
commit 6eb5f1c8d1
2 changed files with 22 additions and 1 deletions

View file

@ -15,6 +15,12 @@
(interactive "P") (interactive "P")
(linum-mode (or arg (if linum-mode -1 +1)))) (linum-mode (or arg (if linum-mode -1 +1))))
;;;###autoload
(defun doom-resize-window (new-size &optional horizontal)
"Resize a window to NEW-SIZE. If HORIZONTAL, do it width-wise."
(enlarge-window (- new-size (if horizontal (window-width) (window-height)))
horizontal))
;;;###autoload ;;;###autoload
(defun doom/window-zoom () (defun doom/window-zoom ()
"Maximize and isolate the current buffer. Activate again to undo this. If the "Maximize and isolate the current buffer. Activate again to undo this. If the
@ -25,3 +31,18 @@ window changes before then, the undo expires."
(jump-to-register ?_) (jump-to-register ?_)
(window-configuration-to-register ?_) (window-configuration-to-register ?_)
(delete-other-windows))) (delete-other-windows)))
(defvar doom--window-wconf nil)
;;;###autoload
(defun doom/window-enlargen ()
"Enlargen the current window. Activate again to undo."
(interactive)
(setq doom--window-enlargened
(if (and doom--window-enlargened
(assoc ?_ register-alist))
(ignore (jump-to-register ?_))
(window-configuration-to-register ?_)
(doom-resize-window (truncate (/ (frame-width) 1.2)) t)
(doom-resize-window (truncate (/ (frame-height) 1.2)))
t)))

View file

@ -255,7 +255,7 @@
"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-zoom "o" #'doom/window-enlargen
;; 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)