add dynamic window margin support to window hydra

This commit is contained in:
2026-11-05 22:49:08 +01:00
parent 30fd644ad4
commit 2912d3842a

View File

@@ -176,12 +176,28 @@ _a_ || _d_ |---| _w_ --- _s_ ="
("s" enlarge-window nil)
("q" nil nil :color red))
;; (set-window-margins nil novel--cur-margin novel--cur-margin)
(setq current-window-margin 0)
(setq current-window-margin-step 10)
(defun tvd-window-margin-add()
(interactive)
(setq current-window-margin (+ current-window-margin current-window-margin-step))
(set-window-margins nil current-window-margin current-window-margin))
(defun tvd-window-margin-sub()
(interactive)
(setq current-window-margin (- current-window-margin current-window-margin-step))
(if (< current-window-margin 0)
(setq current-window-margin 0))
(set-window-margins nil current-window-margin current-window-margin))
(defhydra hydra-windows (:color blue)
"
^Window Management^
^^------------------------------------------------------------------------
_+_ Increase Font | _-_ Decrease Font Resize ^ ^ _w_ ^ ^
_+_: Increase Font | _-_: Decrease Font Resize ^ ^ _w_ ^ ^
_f_: Flip Windows <M-O> ^^ Current _a_ ^ ^ _d_
_4_: Quarter Windows <C-x 4> ^^ Window: ^ ^ _s_ ^ ^
_u_: Windows Undo <C-c left>
@@ -189,7 +205,7 @@ _r_: Windows Redo <C-c right> ^^ _l_: Adjust Background brighter
_i_: Invert Colors <C-c C-i> ^^ _b_: Adjust Background darker
_h_: Toggle Highlight Line Mode ^^ _e_: Eyebrowse Workspaces (C-x C-x)
_n_: Toogle Line Number Mode
_n_: Toogle Line Number Mode ^^ _m_: increase | _M_: decrease margin
^^------------------------------------------------------------------------
Reach this hydra with <C-x w>
@@ -212,6 +228,8 @@ Reach this hydra with <C-x w>
("e" hydra-eyebrowse/body nil)
("h" hl-line-mode nil)
("n" linum-mode nil)
("m" tvd-window-margin-add nil :color pink)
("M" tvd-window-margin-sub nil :color pink)
("q" nil nil :color red))
(global-set-key (kbd "C-x w") 'hydra-windows/body))