aboutsummaryrefslogtreecommitdiff
path: root/modules/ui-navigation.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-11 15:16:56 -0500
committerCraig Jennings <c@cjennings.net>2026-05-11 15:16:56 -0500
commitf837e5f7464932fc49c10a7442dc1a23af61b257 (patch)
tree62a21072c37f44d4daf1657d7d2589177173747c /modules/ui-navigation.el
parentc14d6c8d0f669d694dd765d6f592ce6eb72c50f5 (diff)
downloaddotemacs-f837e5f7464932fc49c10a7442dc1a23af61b257.tar.gz
dotemacs-f837e5f7464932fc49c10a7442dc1a23af61b257.zip
feat(window): resize the split with C-; b <arrow>
`C-; b <left>/<right>/<up>/<down>' moves the active window's divider that way (via `windsize'), then keeps `cj/window-resize-map' active so bare arrows keep nudging until any other key (or `C-g'/`<escape>'). `C-u N C-; b <right>' resizes by N. windsize was on `C-s-<arrow>' (Ctrl+Super), which a tiling WM intercepts, so those keys were useless. I dropped that binding. The package is now `:commands'-deferred, and `windsize-cols'/`windsize-rows' drop to 2 (8/4 overshoots in a held nudge loop). `cj/window-resize-sticky' dispatches on the arrow that triggered it and arms the loop.
Diffstat (limited to 'modules/ui-navigation.el')
-rw-r--r--modules/ui-navigation.el33
1 files changed, 28 insertions, 5 deletions
diff --git a/modules/ui-navigation.el b/modules/ui-navigation.el
index b99a9cac..23e38c0a 100644
--- a/modules/ui-navigation.el
+++ b/modules/ui-navigation.el
@@ -42,16 +42,39 @@
;; ------------------------------ Window Resizing ------------------------------
+;; windsize moves the divider between the active window and a neighbor in the
+;; arrow's direction (preferring the right/bottom border). Its commands have
+;; no repeat mechanism; `cj/window-resize-sticky' below adds one. windsize was
+;; on C-s-<arrow> (Ctrl+Super), which a tiling WM eats, so the keys live under
+;; C-; b instead (bound there in custom-buffer-file.el).
(use-package windsize
- :bind
- ("C-s-<left>" . windsize-left)
- ("C-s-<right>" . windsize-right)
- ("C-s-<up>" . windsize-up)
- ("C-s-<down>" . windsize-down))
+ :commands (windsize-left windsize-right windsize-up windsize-down)
+ :custom
+ (windsize-cols 2) ; default 8 is too jumpy for a held nudge loop
+ (windsize-rows 2)) ; default 4, same reason
;; M-shift = to balance multiple split windows
(keymap-global-set "M-+" #'balance-windows)
+(defvar-keymap cj/window-resize-map
+ :doc "Bare arrows that keep resizing the split after a `C-; b <arrow>'
+resize -- each moves the active window's divider in the arrow's direction
+(via `windsize'). Any other key (or `C-g' / `<escape>') ends the loop."
+ "<left>" #'windsize-left
+ "<right>" #'windsize-right
+ "<up>" #'windsize-up
+ "<down>" #'windsize-down)
+
+(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>'."
+ (interactive)
+ (let ((cmd (keymap-lookup cj/window-resize-map
+ (key-description (vector last-command-event)))))
+ (when cmd (call-interactively cmd)))
+ (set-transient-map cj/window-resize-map t))
+
;; ------------------------------ Window Splitting -----------------------------
(defun cj/split-and-follow-right ()