aboutsummaryrefslogtreecommitdiff
path: root/modules/ui-navigation.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-28 12:02:50 -0400
committerCraig Jennings <c@cjennings.net>2026-06-28 12:02:50 -0400
commitd5fba0cc6294a9fc17993f7389e0df9f984165fb (patch)
treeca16505431c0529d7950e1d6ce39990584f40199 /modules/ui-navigation.el
parent16ad2dde87be8d119c85dcb1a70856000603a189 (diff)
downloaddotemacs-d5fba0cc6294a9fc17993f7389e0df9f984165fb.tar.gz
dotemacs-d5fba0cc6294a9fc17993f7389e0df9f984165fb.zip
feat(windows): bind M-arrow to the window pull-away and resize
M-<arrow> now mirrors C-; b <arrow>. 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.
Diffstat (limited to 'modules/ui-navigation.el')
-rw-r--r--modules/ui-navigation.el14
1 files changed, 12 insertions, 2 deletions
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 <left>/<right>/<up>/<down>'.
+nudging until any other key. Bound to `C-; b <arrow>' and to the global
+`M-<arrow>' keys (each direction); the arrow is read with `event-basic-type',
+so the Meta modifier on the M-<arrow> 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-<arrow> mirrors `C-; b <arrow>': one chord to pull a split from a sole
+;; window or nudge a divider. M-<up>/<down> are otherwise unbound; M-<left>/
+;; <right> shed their word-motion, which stays on `C-<left>'/`C-<right>'.
+(keymap-global-set "M-<left>" #'cj/window-resize-sticky)
+(keymap-global-set "M-<right>" #'cj/window-resize-sticky)
+(keymap-global-set "M-<up>" #'cj/window-resize-sticky)
+(keymap-global-set "M-<down>" #'cj/window-resize-sticky)
+
;; ------------------------------ Window Splitting -----------------------------
(defun cj/split-and-follow-right ()