aboutsummaryrefslogtreecommitdiffstats
path: root/.bash_profile
diff options
context:
space:
mode:
Diffstat (limited to '.bash_profile')
-rw-r--r--.bash_profile13
1 files changed, 10 insertions, 3 deletions
diff --git a/.bash_profile b/.bash_profile
index 0d8af54..ba564c9 100644
--- a/.bash_profile
+++ b/.bash_profile
@@ -25,6 +25,16 @@ for option in autocd globstar; do
shopt -s "$option" 2> /dev/null
done
+# Add tab completion for many Bash commands
+if which brew > /dev/null && [ -f "$(brew --prefix)/etc/bash_completion" ]; then
+ source "$(brew --prefix)/etc/bash_completion"
+fi
+
+# Enable tab completion for `g` by marking it as an alias for `git`
+if type _git &> /dev/null && [ -f /usr/local/etc/bash_completion.d/git-completion.bash ]; then
+ complete -o default -o nospace -F _git g
+fi
+
# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards
[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2 | tr ' ' '\n')" scp sftp ssh
@@ -34,6 +44,3 @@ complete -W "NSGlobalDomain" defaults
# Add `killall` tab completion for common apps
complete -o "nospace" -W "Contacts Calendar Dock Finder Mail Safari iTunes SystemUIServer Terminal Twitter" killall
-
-# If possible, add tab completion for many more commands
-[ -f /etc/bash_completion ] && source /etc/bash_completion