Split off bash completion.

Signed-off-by: Jacob Kiers <jacob@jacobkiers.net>
This commit is contained in:
Jacob Kiers 2014-06-25 18:10:23 +02:00
parent 646138bb6b
commit fb10240506
2 changed files with 15 additions and 13 deletions

View File

@ -0,0 +1,14 @@
# 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

View File

@ -69,23 +69,11 @@ NOCOLOR="$(tput sgr0)"
export EDITOR=`which vim` export EDITOR=`which vim`
# Load prompt and aliases # Load prompt and aliases
for file in ~/dotfiles/includes/bash_{prompt,aliases,functions,git}.bash; do for file in ~/dotfiles/includes/bash_{prompt,aliases,functions,git,completion}.bash; do
[ -r "$file" ] && source "$file" [ -r "$file" ] && source "$file"
done done
unset file unset file
# 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
# Tell ls to be colourful # Tell ls to be colourful
export CLICOLOR=1 export CLICOLOR=1