mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
set completions: add more special variables, fix colors
* add --bold, --italics, all of them, * and we add them as arguments so that they are do not render like long options, they are just self-descriptive literal strings in this context. * solve an unneccessary global var. Fixes #8518
This commit is contained in:
parent
06fada7445
commit
4b018a7608
1 changed files with 28 additions and 16 deletions
|
@ -6,7 +6,7 @@
|
|||
# All locale variables used by set completions
|
||||
#
|
||||
|
||||
set -g __fish_locale_vars LANG LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME
|
||||
set -l __fish_locale_vars LANG LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME
|
||||
|
||||
#
|
||||
# Various helper functions
|
||||
|
@ -49,16 +49,24 @@ 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_trace "Enables execution tracing (if set to non-empty value)"
|
||||
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"
|
||||
function __fish_complete_special_vars
|
||||
printf "%s\t%s\n" \
|
||||
PATH "list of dirs to look for commands in" \
|
||||
CDPATH "list of dirs under which that cd searches" \
|
||||
FISH_DEBUG "list of enabled debug categories" \
|
||||
FISH_DEBUG_OUTPUT "debug output path" \
|
||||
umask "current file creation mask" \
|
||||
fish_handle_reflow "if fish should repaint prompt when the term resizes" \
|
||||
fish_trace "print cmds as they execute, like set -x" \
|
||||
fish_emoji_width "cols wide fish assumes emoji render as" \
|
||||
fish_key_bindings "name of function that sets binds" \
|
||||
fish_autosuggestion_enabled "turns autosuggestions on or off" \
|
||||
fish_ambiguous_width "affects computed width of east asian chars" \
|
||||
fish_escape_delay_ms "How long fish waits to distinguish escape and alt" \
|
||||
fish_greeting "The message to display at start (also a function)" \
|
||||
fish_history "The session id to store history under" \
|
||||
fish_trace "Enables execution tracing (if set to non-empty value)" \
|
||||
fish_user_paths "A list of dirs to prepend to PATH"
|
||||
end
|
||||
|
||||
#
|
||||
|
@ -74,6 +82,7 @@ complete -c set -n "fish_is_nth_token 1" -s u -l unexport -d "Do not export vari
|
|||
complete -c set -n "fish_is_nth_token 1" -s f -l function -d "Make variable function-scoped"
|
||||
complete -c set -n "fish_is_nth_token 1" -s g -l global -d "Make variable scope global"
|
||||
complete -c set -n "fish_is_nth_token 1" -s l -l local -d "Make variable scope local"
|
||||
complete -c set -n "fish_is_nth_token 1" -s L -l long -d 'Do not truncate long lines'
|
||||
complete -c set -n "fish_is_nth_token 1" -s U -l universal -d "Share variable persistently across sessions"
|
||||
complete -c set -n "fish_is_nth_token 1" -s q -l query -d "Test if variable is defined"
|
||||
complete -c set -n "fish_is_nth_token 1" -s h -l help -d "Display help and exit"
|
||||
|
@ -91,7 +100,7 @@ complete -c set -n 'fish_is_nth_token 1; and not __fish_seen_argument -s e -l er
|
|||
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 -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_set_special_vars)"
|
||||
complete -c set -n 'fish_is_nth_token 1; and not __fish_seen_argument -s e -l erase' -x -a "(__fish_complete_special_vars)"
|
||||
# Complete scope-specific variables
|
||||
complete -c set -n 'fish_is_nth_token 1; and __fish_seen_argument -s l -l local' -x -a "(set -l | string replace ' ' \t'Local Variable: ')"
|
||||
complete -c set -n 'fish_is_nth_token 1; and __fish_seen_argument -s g -l global' -x -a "(set -g | string replace ' ' \t'Global Variable: ')"
|
||||
|
@ -107,10 +116,13 @@ complete -c set -n '__fish_seen_argument -s e -l erase; and __fish_seen_argument
|
|||
complete -c set -n '__fish_seen_argument -s e -l erase; and __fish_seen_argument -s l -l local' -f -a "(set -l | string replace ' ' \t'Local Variable: ')"
|
||||
|
||||
# Color completions
|
||||
complete -c set -n __fish_set_is_color -x -a '(set_color --print-colors)'
|
||||
complete -c set -n __fish_set_is_color -s b -l background -x -a '(set_color --print-colors)' -d "Change background color"
|
||||
complete -c set -n __fish_set_is_color -s o -l bold -d 'Make font bold'
|
||||
complete -c set -n __fish_set_is_color -x -a '(set_color --print-colors)' -d 'text color'
|
||||
complete -c set -n __fish_set_is_color -a --background -x -a '(set_color --print-colors)'
|
||||
complete -c set -n __fish_set_is_color -a --bold -x
|
||||
complete -c set -n __fish_set_is_color -a --dim -x
|
||||
complete -c set -n __fish_set_is_color -a --italics -x
|
||||
complete -c set -n __fish_set_is_color -a --reverse -x
|
||||
complete -c set -n __fish_set_is_color -a --underline -x
|
||||
|
||||
# Locale completions
|
||||
complete -c set -n '__fish_set_is_locale; and not __fish_seen_argument -s e -l erase' -x -a '(command -sq locale; and locale -a)' -d Locale
|
||||
complete -c set -s L -l long -d 'Do not truncate long lines'
|
||||
|
|
Loading…
Reference in a new issue