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.
|
||||
|
||||
Navigation:
|
||||
↑ ↓ / j k Move cursor
|
||||
← → Set value directionally: OFF ← DEFAULT → ON (clamped)
|
||||
Space Cycle through all states: ON → OFF → DEFAULT → ON (wraps)
|
||||
↑ ↓ / k j Move cursor
|
||||
← → / h l Set value: OFF ← DEFAULT → ON (clamped)
|
||||
Tab Switch scope (Universal ↔ Session)
|
||||
q / Escape Exit
|
||||
|
||||
Left/Right move one step along the OFF–DEFAULT–ON scale and stop at the
|
||||
ends; Space cycles through every state and wraps around. DEFAULT erases
|
||||
the variable so the master switch / built-in default applies.
|
||||
Left/Right (or vim-style h/l) move the highlighted value one step along
|
||||
the OFF–DEFAULT–ON scale and stop at the ends. DEFAULT erases the
|
||||
variable so the master switch / built-in default applies.
|
||||
|
||||
Flags:
|
||||
--help / -h Show usage.
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#
|
||||
# DESCRIPTION
|
||||
# Applies a state value to an opinionated-component variable in the given
|
||||
# scope, immediately and persistently. Used by config-toggle's Space (cycle)
|
||||
# and Left/Right (directional) handlers so the set/erase logic lives in one
|
||||
# scope, immediately and persistently. Used by config-toggle's Left/Right
|
||||
# (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
|
||||
# master switch / built-in default takes over again.
|
||||
#
|
||||
|
||||
@@ -133,7 +133,7 @@ function __config_toggle_draw
|
||||
# ── Keybind hint ──────────────────────────────────────
|
||||
# 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).
|
||||
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
|
||||
|
||||
# ── Bottom border ─────────────────────────────────────
|
||||
|
||||
@@ -13,8 +13,9 @@
|
||||
# Universal — persists across all sessions (set -U / set -Ue)
|
||||
# Session — active for the current shell only (set -g / set -eg)
|
||||
#
|
||||
# Changes apply immediately on each Space keypress — no confirm step.
|
||||
# Always available regardless of __fish_config_opinionated state.
|
||||
# Values are changed directionally with the arrow keys (or vim-style h/l)
|
||||
# along an OFF ← DEFAULT → ON scale, and apply immediately — no confirm
|
||||
# step. Always available regardless of __fish_config_opinionated state.
|
||||
#
|
||||
# ARGUMENTS
|
||||
# -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
|
||||
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 Set value: OFF ← DEFAULT → ON (clamped)"
|
||||
echo " $c_flag""Space$c_reset Cycle: ON → OFF → DEFAULT → ON (wraps)"
|
||||
echo " $c_flag↑ ↓$c_reset or $c_flag""k j$c_reset Move cursor up / down"
|
||||
echo " $c_flag← →$c_reset or $c_flag""h l$c_reset Set value: OFF ← DEFAULT → ON"
|
||||
echo " $c_flag""Tab$c_reset Switch scope (Universal ↔ Session)"
|
||||
echo " $c_flag""q$c_reset / $c_flag""Esc$c_reset Exit"
|
||||
echo
|
||||
@@ -108,22 +108,7 @@ function config-toggle --description 'Interactive TUI for toggling opinionated c
|
||||
else
|
||||
set cur_scope universal
|
||||
end
|
||||
case space # Space — cycle through all states and apply
|
||||
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)
|
||||
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)
|
||||
|
||||
@@ -138,7 +123,7 @@ function config-toggle --description 'Interactive TUI for toggling opinionated c
|
||||
set next_val on
|
||||
end
|
||||
__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 cur_val (__config_toggle_get_val $varname $cur_scope)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user