Add split-window-and-focus commands

This commit is contained in:
2025-04-14 15:31:59 -07:00
parent 2fc3929ffa
commit a6c7093f8a

View File

@@ -468,6 +468,26 @@
:init
(tab-bar-mode 1))
;;;; Split window and focus
(defun split-window-and-focus (split-function)
"Split the window using SPLIT-FUNCTION and move the cursor to the new window."
(interactive "aSplit function: ")
(let ((new-window (funcall split-function)))
(select-window new-window)))
(defun split-window-below-and-focus ()
"Split the window horizontally and move the cursor below."
(interactive)
(split-window-and-focus 'split-window-below))
(defun split-window-right-and-focus ()
"Split the window vertically and move the cursor to the right."
(interactive)
(split-window-and-focus 'split-window-right))
(use-package emacs
:bind (([remap split-window-below] . split-window-below-and-focus)
([remap split-window-right] . split-window-right-and-focus)))
;;;; Popper
(use-package popper
:ensure t