fork/fish-shell

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

Johannes AltmanningerDocument focus events444cda20b

master
2.2 KiB41 linesraw
1function __fish_complete_signals
2    __fish_make_completion_signals
3    for sig in $__kill_signals
4        # signal name as completion and signal number as description
5        printf "%s\t%s\n" (string split " " $sig)[-1..1]
6    end
7end
8
9function __fish_complete_variables
10    # Borrowed from completions for set command
11    set -l | string replace ' ' \t'Local Variable: '
12    set -g | string replace ' ' \t'Global Variable: '
13    set -U | string replace ' ' \t'Universal Variable: '
14end
15
16function __fish_complete_function_event_handlers
17    set -l handlers fish_prompt "When new prompt is about to be displayed" \
18        fish_command_not_found "When command lookup fails" \
19        fish_preexec "Before executing an interactive command" \
20        fish_postexec "After executing an interactive command" \
21        fish_exit "Right before fish exits" \
22        fish_cancel "When commandline is cleared" \
23        fish_posterror "After executing command with syntax errors" \
24        fish_focus_in "When fish's terminal gains focus" \
25        fish_focus_out "When fish's terminal loses focus"
26
27    printf "%s\t%s\n" $handlers
28end
29
30complete -c function -s d -l description -d "Set function description" -x
31complete -c function -xa "(functions -n)" -d Function
32complete -c function -xa "(builtin -n)" -d Builtin
33complete -c function -s j -l on-job-exit -d "Make the function a job exit event handler" -x
34complete -c function -s p -l on-process-exit -d "Make the function a process exit event handler" -x
35complete -c function -s s -l on-signal -d "Make the function a signal event handler" -xka "(__fish_complete_signals)"
36complete -c function -s v -l on-variable -d "Make the function a variable update event handler" -xa "(__fish_complete_variables)"
37complete -c function -s e -l on-event -d "Make the function a generic event handler" -xa "(__fish_complete_function_event_handlers)"
38complete -c function -s a -l argument-names -d "Specify named arguments" -x
39complete -c function -s S -l no-scope-shadowing -d "Do not shadow variable scope of calling function"
40complete -c function -s w -l wraps -d "Inherit completions from the given command" -xa "(__fish_complete_command)"
41complete -c function -s V -l inherit-variable -d "Snapshot and define local variable" -xa "(__fish_complete_variables)"