oh-my-fish/plugins/better-alias/balias.fish

12 lines
321 B
Fish
Raw Normal View History

2014-08-23 19:13:11 +08:00
function balias --argument alias command
eval 'alias $alias $command'
if expr match $command '^sudo '>/dev/null
set command (expr substr + $command 6 (expr length $command))
end
complete -c $alias -xa "(
set -l cmd (commandline -pc | sed -e 's/^ *\S\+ *//' );
complete -C\"$command \$cmd\";
)"
end