mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 10:57:30 +08:00
completions/set: strip cursed descriptions from history/fish_killring
If I type $ echo $SOME_VARIABLE_WIHT_A_TYPO $ set -S SOME_VARIABLE_WIHT and press tab, I'm always extremely surprised that this completes to $ set -S fish_history which is because $history[1] contains the typo'd variable name. I don't think anyone intends to filter by that last 3-4 history items, so let's remove this pitfall. Note that I usually hit this scenario with undefined variables, not necessarily typos.. "set -S" is usually redundant but it's still quite nice in this case, to rule out any weird empty strings/empty lists.
This commit is contained in:
parent
444cda20bc
commit
18f6492564
|
@ -94,7 +94,7 @@ complete -c set -n "__fish_is_nth_token 1" -l unpath -d "Make variable not as a
|
|||
|
||||
# Complete using preexisting variable names
|
||||
complete -c set -n '__fish_is_nth_token 1; and not __fish_seen_argument -s e -l erase; and not __fish_seen_argument -s l -s g -s U -l local -l global -l universal' -x -a "(set -l | string match -rv '^__' | string replace ' ' \t'Local Variable: ')"
|
||||
complete -c set -n '__fish_is_nth_token 1; and not __fish_seen_argument -s e -l erase; and not __fish_seen_argument -s l -s g -s U -l local -l global -l universal' -x -a "(set -g | string match -rv '^__' | string replace ' ' \t'Global Variable: ')"
|
||||
complete -c set -n '__fish_is_nth_token 1; and not __fish_seen_argument -s e -l erase; and not __fish_seen_argument -s l -s g -s U -l local -l global -l universal' -x -a "(set -g | string match -rv '^__' | string replace -r '^((?:history|fish_killring) ) .*' '$1' | string replace ' ' \t'Global Variable: ')"
|
||||
complete -c set -n '__fish_is_nth_token 1; and not __fish_seen_argument -s e -l erase; and not __fish_seen_argument -s l -s g -s U -l local -l global -l universal' -x -a "(set -U | string match -rv '^__' | string replace ' ' \t'Universal Variable: ')"
|
||||
# Complete some fish configuration variables even if they aren't set.
|
||||
complete -c set -n '__fish_is_nth_token 1; and not __fish_seen_argument -s e -l erase' -x -a "(__fish_complete_special_vars)"
|
||||
|
|
Loading…
Reference in New Issue
Block a user