fish-shell/share/functions/__fish_complete_command.fish
Johannes Altmanninger 36693e4391 Complete empty subcomands consistently
If the command is empty, try to complete starting from the empty command
instead of the whole commandline.
2019-11-05 09:05:46 +01:00

12 lines
423 B
Fish

function __fish_complete_command --description 'Complete using all available commands'
set -l ctoken (commandline -ct)
switch $ctoken
case '*=*'
set ctoken (string split "=" -- $ctoken)
printf '%s\n' $ctoken[1]=(complete -C "$ctoken[2]")
case '-*' # do not try to complete options as commands
return
case '*'
complete -C "$ctoken"
end
end