Make window manipulation transient hint collapsible

Window sizing and layouts can be affected by a large transient state hint,
so having a option for minified hint is especially useful here.

Also reformats the full hint to place `golden ratio` under the "Resize" heading,
reducing overall height by one row.
This commit is contained in:
yuhan0 2018-10-31 11:15:14 +08:00 committed by duianto
parent f961d622cf
commit 13fd53d65d
1 changed files with 32 additions and 8 deletions

View File

@ -642,22 +642,46 @@ respond to this toggle."
(interactive "p")
(enlarge-window delta t))
(spacemacs|define-transient-state window-manipulation
:title "Window Manipulation Transient State"
:doc (concat "
(defun spacemacs//window-manipulation-ts-toggle-hint ()
"Toggle the full hint docstring for the window manipulation transient-state."
(interactive)
(setq spacemacs--ts-full-hint-toggle
(logxor spacemacs--ts-full-hint-toggle 1)))
(defun spacemacs//window-manipulation-ts-hint ()
"Return a condensed/full hint for the window manipulation transient state"
(concat
" "
(if (equal 1 spacemacs--ts-full-hint-toggle)
spacemacs--window-manipulation-ts-full-hint
(concat spacemacs--window-manipulation-ts-minified-hint
" ([" (propertize "?" 'face 'hydra-face-red) "] help)"))))
(spacemacs|transient-state-format-hint window-manipulation
spacemacs--window-manipulation-ts-minified-hint "
Select: _w_ _h_ _j_ _k_ _l_ _0_.._9_ Move: _H_ _J_ _K_ _L_ _r_ _R_ Split: _s_ _v_ Resize: _[_ _]_ _{_ _}_")
(spacemacs|transient-state-format-hint window-manipulation
spacemacs--window-manipulation-ts-full-hint
(format "\n [_?_] toggle help
Select^^^^ Move^^^^ Split^^ Resize^^ Other^^
^^^^ ^^^^ ^^ ^^ ^^
[_j_/_k_] down/up [_J_/_K_] down/up [_s_] horizontal [_[_] shrink horiz [_u_] restore prev layout
[_h_/_l_] left/right [_H_/_L_] left/right [_S_] horiz & follow [_]_] enlarge horiz [_U_] restore next layout
[_0_.._9_] window 0..9 [_r_]^^ rotate fwd [_v_] vertical [_{_] shrink verti [_d_] close current
[_w_]^^ other window [_R_]^^ rotate bwd [_V_] verti & follow [_}_] enlarge verti [_D_] close other
[_o_]^^ other frame ^^^^ ^^ ^^ "
(if (configuration-layer/package-used-p 'golden-ratio)
"[_g_] golden-ratio %`golden-ratio-mode"
"")
"\n ^^^^ ^^^^ ^^ ^^ [_q_] quit")
[_o_]^^ other frame ^^^^ ^^ %s^^^^^^^^^^^^^^^^^^ [_q_] quit"
(if (configuration-layer/package-used-p 'golden-ratio)
"[_g_] golden-ratio "
"^^^^ ")))
(spacemacs|define-transient-state window-manipulation
:title "Window Manipulation TS"
:hint-is-doc t
:dynamic-hint (spacemacs//window-manipulation-ts-hint)
:bindings
("q" nil :exit t)
("?" spacemacs//window-manipulation-ts-toggle-hint)
("0" winum-select-window-0)
("1" winum-select-window-1)
("2" winum-select-window-2)