From 38bd3a3b9907fa470a0cafc3c729bfce4d09b520 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Tue, 5 Jan 2016 07:31:09 +0100 Subject: [PATCH] Loading Homebrew Bash Completion if installed In addition to the regular /etc/bash_completion, the one from Homebrew is loaded when running on OS X, and when Homebrew is installed. Also added the system completion to the default install options, since this is a feature that's requested frequently. --- completion/available/system.completion.bash | 13 ++++++++++++- install.sh | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/completion/available/system.completion.bash b/completion/available/system.completion.bash index d3076593..aeaa5375 100644 --- a/completion/available/system.completion.bash +++ b/completion/available/system.completion.bash @@ -1,5 +1,16 @@ #!/usr/bin/env bash +# Loads the system's Bash completion modules. +# If Homebrew is installed (OS X), its Bash completion modules are loaded. + if [ -f /etc/bash_completion ]; then - . /etc/bash_completion + . /etc/bash_completion +fi + +if [ $(uname) = "Darwin" ] && command -v brew &>/dev/null ; then + BREW_PREFIX=$(brew --prefix) + + if [ -f "$BREW_PREFIX"/etc/bash_completion ]; then + . "$BREW_PREFIX"/etc/bash_completion + fi fi diff --git a/install.sh b/install.sh index b9926110..d3c9b001 100755 --- a/install.sh +++ b/install.sh @@ -89,6 +89,7 @@ else echo "" echo -e "\033[0;32mEnabling sane defaults\033[0m" load_one completion bash-it.completion.bash + load_one completion system.completion.bash load_one plugins base.plugin.bash load_one plugins alias-completion.plugin.bash load_one aliases general.aliases.bash