dotfiles/includes/bash_completion.bash
Jacob Kiers 56a65c36c5 Improve aliases and autocompletion.
Signed-off-by: Jacob Kiers <jacob@jacobkiers.net>
2014-09-25 09:55:13 +02:00

19 lines
805 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