summary refs log tree commit diff
path: root/emacs
diff options
context:
space:
mode:
authornoa@gaiwan.org2024-06-15 17:17:16 +0000
committernoa@gaiwan.org2024-06-15 17:17:16 +0000
commit9562511508e06fdeb4365ff60db4ee09949b883e (patch)
tree3a8075b667346aa4196c81d77684ce3763f21b95 /emacs
parent2c0ccf5701b53bb143221c41d823789d2974227f (diff)
Rebind window creation commands to switch to the new window
Diffstat (limited to 'emacs')
-rw-r--r--emacs/init.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/emacs/init.el b/emacs/init.el
index 9f992c7..827a640 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -878,6 +878,19 @@ The misspelled word is taken from OVERLAY.  WORD is the corrected word."
 (global-set-key [remap query-replace-regexp] 'anzu-query-replace-regexp)
 
 
+;; Switch to new window on creation
+(defun noa/split-and-follow-horizontally ()
+  (interactive)
+  (split-window-below)
+  (other-window 1))
+(global-set-key (kbd "C-x 2") 'noa/split-and-follow-horizontally)
+
+(defun noa/split-and-follow-vertically ()
+  (interactive)
+  (split-window-right)
+  (other-window 1))
+(global-set-key (kbd "C-x 3") 'noa/split-and-follow-vertically)
+
 (setopt shell-file-name "/bin/sh")
 
 (defun snarf-song (url)