fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

phaniumAdd --color option for some builtinsc23a4cbd9

master
1.9 KiB44 linesraw
1set -l bind_optspecs \
2    a/all \
3    e/erase \
4    M/mode= \
5    m/sets-mode= \
6    preset \
7    s/silent \
8    user
9
10function __fish_bind_has_keys --inherit-variable bind_optspecs
11    argparse $bind_optspecs -- $argv 2>/dev/null
12    or return
13    test (count $argv) -ge 2
14end
15
16complete -c bind -f
17complete -c bind -s a -l all -d 'Show unavailable key bindings/erase all bindings'
18complete -c bind -s e -l erase -d 'Erase mode'
19complete -c bind -s f -l function-names -d 'Print names of available functions'
20complete -c bind -s h -l help -d "Display help and exit"
21complete -c bind -s K -l key-names -d 'Print names of available keys'
22complete -c bind -s M -l mode -d 'Specify the bind mode that the bind is used in' -xa '(bind -L)'
23complete -c bind -s m -l sets-mode -d 'Change current mode after bind is executed' -xa '(bind -L)'
24complete -c bind -s L -l list-modes -d 'Display a list of defined bind modes'
25complete -c bind -s s -l silent -d 'Operate silently'
26complete -c bind -l preset -d 'Operate on preset bindings'
27complete -c bind -l user -d 'Operate on user bindings'
28complete -c bind -l color -d 'When to colorize output' -xa 'always never auto'
29
30complete -c bind -n '__fish_bind_has_keys (commandline -pcx)' -a '(bind --function-names)' -d 'Function name' -x
31
32function __fish_bind_complete --inherit-variable bind_optspecs
33    argparse $bind_optspecs -- (commandline -xpc)[2..] 2>/dev/null
34    or return 1
35    set -l token (commandline -ct)
36    if test (count $argv) = 0 && set -l prefix (string match -r -- '(.*,)?(ctrl-|alt-|shift-|super-)*' $token)
37        printf '%salt-\tAlt modifier…\n' $prefix
38        printf '%sctrl-\tCtrl modifier…\n' $prefix
39        printf '%sshift-\tShift modifier…\n' $prefix
40        printf '%ssuper-\tSuper modifier…\n' $prefix
41        printf '%s\tNamed key\n' $prefix(bind --key-names)
42    end
43end
44complete -c bind -k -a '(__fish_bind_complete)' -f