completions/set: Complete some config vars even if they aren't set

Fixes #5884.

[ci skip]
This commit is contained in:
Fabian Homborg 2019-05-21 17:00:32 +02:00
parent 714b8420a9
commit 261198aa3e

View File

@ -49,6 +49,17 @@ function __fish_set_is_locale -d 'Test if We are specifying a locale value for t
return 1
end
function __fish_set_special_vars
printf %s\t%s\n CDPATH "A list of dirs that cd uses"
printf %s\t%s\n fish_emoji_width "How wide your terminal displays emoji (2 since Unicode 9, 1 previously)"
printf %s\t%s\n fish_ambiguous_width "How wide your terminal displays ambiguous chars (1 or 2)"
printf %s\t%s\n fish_escape_delay_ms "How long fish waits to distinguish escape and alt"
printf %s\t%s\n fish_greeting "The message to display at start (also a function)"
printf %s\t%s\n fish_history "The session id to store history under"
printf %s\t%s\n fish_user_paths "A list of dirs to prepend to PATH"
printf %s\t%s\n BROWSER "The browser to use"
end
#
# Completions
#
@ -75,6 +86,8 @@ complete -c set -n '__fish_is_first_token' -s S -l show -d "Show variable"
complete -c set -n '__fish_is_first_token; 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_first_token; 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_first_token; 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_first_token; and not __fish_seen_argument -s e -l erase' -x -a "(__fish_set_special_vars)"
# Complete scope-specific variables
complete -c set -n '__fish_is_first_token; and __fish_seen_argument -s l -l local' -x -a "(set -l | string match -rv '^__' | string replace ' ' \t'Local Variable: ')"
complete -c set -n '__fish_is_first_token; and __fish_seen_argument -s g -l global' -x -a "(set -g | string match -rv '^__' | string replace ' ' \t'Global Variable: ')"