Improvements for C-o b and implement C-o z

This commit is contained in:
2024-09-19 15:28:18 -07:00
parent 60f0ac25fd
commit 998a86c65c

View File

@@ -1,10 +1,34 @@
(provide 'thoom-tweaks)
(defun consult-buffer-other-window-no-focus ()
(interactive)
(with-selected-window (next-window)
(consult-buffer)))
(defvar thoom/zoom-saved-windows nil
"Variable to store the current window configuration for thoom/zoom.")
(defun thoom/zoom-window ()
"Delete other windows, or restore the saved window configuration if available."
(interactive)
(if (and thoom/zoom-saved-windows
(not (window-configuration-p thoom/zoom-saved-windows)))
;; Clean up if the saved config isn't valid anymore.
(setq thoom/zoom-saved-windows nil))
(if thoom/zoom-saved-windows
(progn
(set-window-configuration thoom/zoom-saved-windows)
(setq thoom/zoom-saved-windows nil))
(setq thoom/zoom-saved-windows (current-window-configuration))
(delete-other-windows)))
(use-package emacs
:bind (("C-o" . nil)
("C-o C-o" . other-window)
("C-o o" . other-window)
("C-o b" . consult-buffer-other-window)
("C-o b" . consult-buffer-other-window-no-focus)
("C-o B" . consult-buffer-other-window)
("C-o /" . split-window-right)
("C-o -" . split-window-below)
("C-o C-k" . delete-window)
@@ -17,6 +41,7 @@
;; TODO C-wasd for resizing
;; TODO C-/ for undo window state change
;; TODO z for zooming
("C-o z" . thoom/zoom-window)
;; TODO other-window scrolling
("C-o n" . next-buffer)
("C-o p" . previous-buffer)