mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-14 17:07:44 +00:00
149a0b98af
I really kinda hate how insistent clang-format is to have line breaks *IFF THE LINE IS TOO LONG*. Like... lemme just add a break if it looks better, will you? But it is the style at this time, so we shall tie an onion to our belt.
39 lines
2.1 KiB
Fish
39 lines
2.1 KiB
Fish
function __fish_complete_signals
|
|
__fish_make_completion_signals
|
|
for sig in $__kill_signals
|
|
# signal name as completion and signal number as description
|
|
printf "%s\t%s\n" (string split " " $sig)[-1..1]
|
|
end
|
|
end
|
|
|
|
function __fish_complete_variables
|
|
# Borrowed from completions for set command
|
|
set -l | string replace ' ' \t'Local Variable: '
|
|
set -g | string replace ' ' \t'Global Variable: '
|
|
set -U | string replace ' ' \t'Universal Variable: '
|
|
end
|
|
|
|
function __fish_complete_function_event_handlers
|
|
set -l handlers fish_prompt "When new prompt is about to be displayed" \
|
|
fish_command_not_found "When command lookup fails" \
|
|
fish_preexec "Before executing an interactive command" \
|
|
fish_postexec "After executing an interactive command" \
|
|
fish_exit "Right before fish exits" \
|
|
fish_cancel "When commandline is cleared" \
|
|
fish_posterror "After executing command with syntax errors"
|
|
|
|
printf "%s\t%s\n" $handlers
|
|
end
|
|
|
|
complete -c function -s d -l description -d "Set function description" -x
|
|
complete -c function -xa "(functions -n)" -d Function
|
|
complete -c function -xa "(builtin -n)" -d Builtin
|
|
complete -c function -s j -l on-job-exit -d "Make the function a job exit event handler" -x
|
|
complete -c function -s p -l on-process-exit -d "Make the function a process exit event handler" -x
|
|
complete -c function -s s -l on-signal -d "Make the function a signal event handler" -xka "(__fish_complete_signals)"
|
|
complete -c function -s v -l on-variable -d "Make the function a variable update event handler" -xa "(__fish_complete_variables)"
|
|
complete -c function -s e -l on-event -d "Make the function a generic event handler" -xa "(__fish_complete_function_event_handlers)"
|
|
complete -c function -s a -l argument-names -d "Specify named arguments" -x
|
|
complete -c function -s S -l no-scope-shadowing -d "Do not shadow variable scope of calling function"
|
|
complete -c function -s w -l wraps -d "Inherit completions from the given command" -xa "(__fish_complete_command)"
|
|
complete -c function -s V -l inherit-variable -d "Snapshot and define local variable" -xa "(__fish_complete_variables)"
|