You are not logged in.
Pages: 1
Bash uses a function called _completion_loader to dynamically load completion functions for each program. This works whenever the program is correctly called by its name. So for example, typing 'pacman -Qi s' and hitting Tab offers all installed packages starting with s. Now I alias 'pacman' to 'p' and advise bash to use the pacman completer for p also. This works in the current running shell but fails with a new shell, because the completer was not yet loaded there.
What can be done so that the alias also loads the pacman completion function?
Offline
You could add pacman's completion function in your bashrc:
alias p=pacman
if [ -f /usr/share/bash-completion/completions/pacman ]; then
. /usr/share/bash-completion/completions/pacman
complete -F _pacman -o filenames -o default p
fi
Offline
This would definitely work, but defeats the purpose of dynamic completion loading to begin with.
A symlink from p to pacman in /etc/bash_completion.d/ would solve the problem. But this would affect other users that may have p bound to something else.
Offline
Pages: 1