4b36c35285
Now it is easy to add new completion scripts: just drop them in the bash_completion.d directory. Signed-off-by: Jacob Kiers <kiers@comandi.nl>
27 lines
973 B
Bash
27 lines
973 B
Bash
# If possible, add tab completion for many commands
|
|
[ -f /etc/bash_completion ] && source /etc/bash_completion
|
|
|
|
# Bash completion (installed via Homebrew; source after `brew` is added to PATH)
|
|
command -v brew >/dev/null 2>&1 && [ -r "$(brew --prefix)/etc/bash_completion" ] && source "$(brew --prefix)/etc/bash_completion"
|
|
|
|
# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards
|
|
function _ssh_reload_autocomplete() {
|
|
[ -e "~/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2)" scp sftp ssh
|
|
}
|
|
_ssh_reload_autocomplete
|
|
|
|
# Add AWS CLI Completion.
|
|
complete -C aws_completer aws
|
|
complete -F _tmux t
|
|
|
|
# Add Gush completion.
|
|
[ -f $HOME/.gush/.gush-autocomplete.bash ] && source $HOME/.gush/.gush-autocomplete.bash
|
|
|
|
if [ -d $HOME/dotfiles/bash_completion.d ];
|
|
then
|
|
for file in `find $HOME/dotfiles/bash_completion.d/ -type f -name '*.sh'`
|
|
do
|
|
source $file
|
|
done
|
|
fi
|