summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-09-02 22:47:52 -0500
committerCraig Jennings <c@cjennings.net>2025-09-02 22:47:52 -0500
commit43bfa3933844ecb16fc032373232d160bb655130 (patch)
tree6a22d070a523e7a42b70e883d1cceb06ddb584b0 /modules
parent15f70bab3201f60f32dac64373dbb4353560d2db (diff)
downloaddotemacs-43bfa3933844ecb16fc032373232d160bb655130.tar.gz
dotemacs-43bfa3933844ecb16fc032373232d160bb655130.zip
select content before splitting window and leverage ivy
Diffstat (limited to 'modules')
-rw-r--r--modules/ui-navigation.el46
1 files changed, 29 insertions, 17 deletions
diff --git a/modules/ui-navigation.el b/modules/ui-navigation.el
index 77d1fcbe..f2b743ac 100644
--- a/modules/ui-navigation.el
+++ b/modules/ui-navigation.el
@@ -51,25 +51,37 @@
;; ------------------------------ Window Splitting -----------------------------
-;; SPLIT VERTICALLY
-(defun split-and-follow-right ()
- "Open a new window horizontally to the right of the current window.
-Open ibuffer in the other window for easy buffer selection."
+(defun cj/split-and-follow-right ()
+ "Like =ivy-switch-buffer-other-window' but always split horizontally."
(interactive)
- (split-window-right)
- (other-window 1)
- (ibuffer))
-(global-set-key (kbd "M-V") 'split-and-follow-right)
-
-;; SPLIT HORIZONTALLY
-(defun split-and-follow-below ()
- "Open a new window vertically below the current window.
-Open ibuffer in the other window for easy buffer selection."
+ (let ((split-height-threshold nil) ; Disable vertical splitting
+ (split-width-threshold 0)) ; Always prefer horizontal splitting
+ (ivy-switch-buffer-other-window)))
+(global-set-key (kbd "M-V") 'cj/split-and-follow-right)
+
+(defun cj/split-and-follow-below ()
+ "Like =ivy-switch-buffer-other-window' but always split vertically."
(interactive)
- (split-window-below)
- (other-window 1)
- (ibuffer))
-(global-set-key (kbd "M-H") 'split-and-follow-below)
+ (let ((split-height-threshold 0) ; Always prefer vertical splitting
+ (split-width-threshold nil)) ; Disable horizontal splitting
+ (ivy-switch-buffer-other-window)))
+(global-set-key (kbd "M-H") 'cj/split-and-follow-below)
+
+;; (defun cj/split-and-follow-right ()
+;; "Open a new window horizontally to the right of the current window.
+;; Open ibuffer in the other window for easy buffer selection."
+;; (interactive)
+;; (split-window-right)
+;; (other-window 1)
+;; (ibuffer))
+
+;; (defun cj/split-and-follow-below ()
+;; "Open a new window vertically below the current window.
+;; Open ibuffer in the other window for easy buffer selection."
+;; (interactive)
+;; (split-window-below)
+;; (other-window 1)
+;; (ibuffer))
;; ------------------------- Split Window Reorientation ------------------------