feat(config-toggle): drop Space, add vim h/l for value changes
Directional arrows fully cover value changes, so the Space cycle is removed. Add h/l as vim-style aliases for ←/→ (matching the existing j/k for up/down), keeping the whole keymap hjkl-consistent. Update the in-panel hint, help text, docstrings, and offline docs accordingly.
This commit is contained in:
+5
-6
@@ -1236,15 +1236,14 @@ Add -i (interactive confirmation) to destructive commands:
|
|||||||
regardless of the __fish_config_opinionated master state.
|
regardless of the __fish_config_opinionated master state.
|
||||||
|
|
||||||
Navigation:
|
Navigation:
|
||||||
↑ ↓ / j k Move cursor
|
↑ ↓ / k j Move cursor
|
||||||
← → Set value directionally: OFF ← DEFAULT → ON (clamped)
|
← → / h l Set value: OFF ← DEFAULT → ON (clamped)
|
||||||
Space Cycle through all states: ON → OFF → DEFAULT → ON (wraps)
|
|
||||||
Tab Switch scope (Universal ↔ Session)
|
Tab Switch scope (Universal ↔ Session)
|
||||||
q / Escape Exit
|
q / Escape Exit
|
||||||
|
|
||||||
Left/Right move one step along the OFF–DEFAULT–ON scale and stop at the
|
Left/Right (or vim-style h/l) move the highlighted value one step along
|
||||||
ends; Space cycles through every state and wraps around. DEFAULT erases
|
the OFF–DEFAULT–ON scale and stop at the ends. DEFAULT erases the
|
||||||
the variable so the master switch / built-in default applies.
|
variable so the master switch / built-in default applies.
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
--help / -h Show usage.
|
--help / -h Show usage.
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
#
|
#
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
# Applies a state value to an opinionated-component variable in the given
|
# Applies a state value to an opinionated-component variable in the given
|
||||||
# scope, immediately and persistently. Used by config-toggle's Space (cycle)
|
# scope, immediately and persistently. Used by config-toggle's Left/Right
|
||||||
# and Left/Right (directional) handlers so the set/erase logic lives in one
|
# (and vim h/l) directional handlers so the set/erase logic lives in one
|
||||||
# place. A value of "DEFAULT" erases the variable in that scope so the
|
# place. A value of "DEFAULT" erases the variable in that scope so the
|
||||||
# master switch / built-in default takes over again.
|
# master switch / built-in default takes over again.
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ function __config_toggle_draw
|
|||||||
# ── Keybind hint ──────────────────────────────────────
|
# ── Keybind hint ──────────────────────────────────────
|
||||||
# Padded to the inner width so the right border stays aligned regardless
|
# Padded to the inner width so the right border stays aligned regardless
|
||||||
# of the hint text. string pad is width-aware (arrows count as 1 column).
|
# of the hint text. string pad is width-aware (arrows count as 1 column).
|
||||||
set -l hint " ↑↓ move ←→ set Space cycle Tab scope q quit"
|
set -l hint " ↑↓/kj move ←→/hl set Tab scope q quit"
|
||||||
printf '│%s%s%s│\n' $c_dim (string pad -r -w $IW -- $hint) $c_reset
|
printf '│%s%s%s│\n' $c_dim (string pad -r -w $IW -- $hint) $c_reset
|
||||||
|
|
||||||
# ── Bottom border ─────────────────────────────────────
|
# ── Bottom border ─────────────────────────────────────
|
||||||
|
|||||||
@@ -13,8 +13,9 @@
|
|||||||
# Universal — persists across all sessions (set -U / set -Ue)
|
# Universal — persists across all sessions (set -U / set -Ue)
|
||||||
# Session — active for the current shell only (set -g / set -eg)
|
# Session — active for the current shell only (set -g / set -eg)
|
||||||
#
|
#
|
||||||
# Changes apply immediately on each Space keypress — no confirm step.
|
# Values are changed directionally with the arrow keys (or vim-style h/l)
|
||||||
# Always available regardless of __fish_config_opinionated state.
|
# along an OFF ← DEFAULT → ON scale, and apply immediately — no confirm
|
||||||
|
# step. Always available regardless of __fish_config_opinionated state.
|
||||||
#
|
#
|
||||||
# ARGUMENTS
|
# ARGUMENTS
|
||||||
# -h, --help Print usage and exit
|
# -h, --help Print usage and exit
|
||||||
@@ -43,9 +44,8 @@ function config-toggle --description 'Interactive TUI for toggling opinionated c
|
|||||||
echo " Changes apply immediately — no confirm step required."
|
echo " Changes apply immediately — no confirm step required."
|
||||||
echo
|
echo
|
||||||
echo "$c_head""Navigation:$c_reset"
|
echo "$c_head""Navigation:$c_reset"
|
||||||
echo " $c_flag↑ ↓$c_reset or $c_flag""j k$c_reset Move cursor up / down"
|
echo " $c_flag↑ ↓$c_reset or $c_flag""k j$c_reset Move cursor up / down"
|
||||||
echo " $c_flag← →$c_reset Set value: OFF ← DEFAULT → ON (clamped)"
|
echo " $c_flag← →$c_reset or $c_flag""h l$c_reset Set value: OFF ← DEFAULT → ON"
|
||||||
echo " $c_flag""Space$c_reset Cycle: ON → OFF → DEFAULT → ON (wraps)"
|
|
||||||
echo " $c_flag""Tab$c_reset Switch scope (Universal ↔ Session)"
|
echo " $c_flag""Tab$c_reset Switch scope (Universal ↔ Session)"
|
||||||
echo " $c_flag""q$c_reset / $c_flag""Esc$c_reset Exit"
|
echo " $c_flag""q$c_reset / $c_flag""Esc$c_reset Exit"
|
||||||
echo
|
echo
|
||||||
@@ -108,22 +108,7 @@ function config-toggle --description 'Interactive TUI for toggling opinionated c
|
|||||||
else
|
else
|
||||||
set cur_scope universal
|
set cur_scope universal
|
||||||
end
|
end
|
||||||
case space # Space — cycle through all states and apply
|
case right l # → / l — step toward ON (clamped, no wrap)
|
||||||
set -l varname $vars[(math $cur_row + 1)]
|
|
||||||
set -l cur_val (__config_toggle_get_val $varname $cur_scope)
|
|
||||||
|
|
||||||
# Cycle (wraps): on → off → DEFAULT → on
|
|
||||||
set -l next_val on
|
|
||||||
switch $cur_val
|
|
||||||
case on
|
|
||||||
set next_val off
|
|
||||||
case off
|
|
||||||
set next_val DEFAULT
|
|
||||||
case '*' # DEFAULT or any unrecognised
|
|
||||||
set next_val on
|
|
||||||
end
|
|
||||||
__config_toggle_apply $varname $cur_scope $next_val
|
|
||||||
case right # → step toward ON (clamped, no wrap)
|
|
||||||
set -l varname $vars[(math $cur_row + 1)]
|
set -l varname $vars[(math $cur_row + 1)]
|
||||||
set -l cur_val (__config_toggle_get_val $varname $cur_scope)
|
set -l cur_val (__config_toggle_get_val $varname $cur_scope)
|
||||||
|
|
||||||
@@ -138,7 +123,7 @@ function config-toggle --description 'Interactive TUI for toggling opinionated c
|
|||||||
set next_val on
|
set next_val on
|
||||||
end
|
end
|
||||||
__config_toggle_apply $varname $cur_scope $next_val
|
__config_toggle_apply $varname $cur_scope $next_val
|
||||||
case left # ← step toward OFF (clamped, no wrap)
|
case left h # ← / h — step toward OFF (clamped, no wrap)
|
||||||
set -l varname $vars[(math $cur_row + 1)]
|
set -l varname $vars[(math $cur_row + 1)]
|
||||||
set -l cur_val (__config_toggle_get_val $varname $cur_scope)
|
set -l cur_val (__config_toggle_get_val $varname $cur_scope)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user