diff --git a/share/completions/functions.fish b/share/completions/functions.fish index c25e9777e..6010f583a 100644 --- a/share/completions/functions.fish +++ b/share/completions/functions.fish @@ -1,4 +1,13 @@ -complete -c functions -s e -l erase -d "Erase function" -x -a "(functions -n)" +function __fish_maybe_list_all_functions + # if the current commandline token starts with an _, list all functions + if string match -qr -- '^_' (commandline -ct) + functions -an + else + functions -n + end +end + +complete -c functions -s e -l erase -d "Erase function" -x -a "(__fish_maybe_list_all_functions)" complete -c functions -xa "(functions -na)" -d "Function" complete -c functions -s a -l all -d "Show hidden functions" complete -c functions -s h -l help -d "Display help and exit"