From d5fba0cc6294a9fc17993f7389e0df9f984165fb Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 28 Jun 2026 12:02:50 -0400 Subject: feat(windows): bind M-arrow to the window pull-away and resize M- now mirrors C-; b . From a sole window it pulls a sliver split open on the opposite edge, revealing the previous buffer. In a multi-window layout it nudges the divider via windsize. cj/window-resize-sticky derives the arrow with event-basic-type, so one command serves both chords. M-up/down were unbound, and M-left/right shed word-motion, which stays on C-left/right. org and other modes that own M-arrow still shadow it, so C-; b remains the universal binding. --- modules/ui-navigation.el | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/ui-navigation.el b/modules/ui-navigation.el index cb0fc5697..76dd686a6 100644 --- a/modules/ui-navigation.el +++ b/modules/ui-navigation.el @@ -110,7 +110,9 @@ existing split does. No-op when SIDE is nil." (defun cj/window-resize-sticky () "Resize the active window's divider in the just-pressed arrow's direction \(via `windsize'), then keep `cj/window-resize-map' active so bare arrows keep -nudging until any other key. Bound to `C-; b ///'. +nudging until any other key. Bound to `C-; b ' and to the global +`M-' keys (each direction); the arrow is read with `event-basic-type', +so the Meta modifier on the M- path is stripped and both behave alike. When the selected window is the sole window in the frame there is no divider to move, so the first arrow instead splits a sliver away on the @@ -119,13 +121,21 @@ buffer; the current window keeps almost the whole frame and the following arrows shrink it via `windsize', so it reads the same as resizing an existing split." (interactive) - (let ((key (key-description (vector last-command-event)))) + (let ((key (format "<%s>" (event-basic-type last-command-event)))) (if (one-window-p) (cj/window--pull-away (cj/window-pull-side key)) (let ((cmd (keymap-lookup cj/window-resize-map key))) (when cmd (call-interactively cmd))))) (set-transient-map cj/window-resize-map t)) +;; M- mirrors `C-; b ': one chord to pull a split from a sole +;; window or nudge a divider. M-/ are otherwise unbound; M-/ +;; shed their word-motion, which stays on `C-'/`C-'. +(keymap-global-set "M-" #'cj/window-resize-sticky) +(keymap-global-set "M-" #'cj/window-resize-sticky) +(keymap-global-set "M-" #'cj/window-resize-sticky) +(keymap-global-set "M-" #'cj/window-resize-sticky) + ;; ------------------------------ Window Splitting ----------------------------- (defun cj/split-and-follow-right () -- cgit v1.2.3