Skip to content

Instantly share code, notes, and snippets.

@wbs75
Last active August 29, 2015 14:02
Show Gist options
  • Save wbs75/ee89a09fd090852d4909 to your computer and use it in GitHub Desktop.
Save wbs75/ee89a09fd090852d4909 to your computer and use it in GitHub Desktop.
"bash_profile" for boxen
# Load ~/.bash_prompt, ~/.exports, ~/.aliases, ~/.functions and ~/.extra
# ~/.extra can be used for settings you don’t want to commit
# Add `~/bin` to the `$PATH`
export PATH="$HOME/bin:$PATH"
for file in ~/.{path,bash_prompt,exports,aliases,functions,extra}; do
[ -r "$file" ] && source "$file"
done
if [ -f /opt/boxen/homebrew/etc/bash_completion ]; then
. /opt/boxen/homebrew/etc/bash_completion
fi
[ -f /etc/bash_completion ] && source /etc/bash_completion
# Case-insensitive globbing (used in pathname expansion)
shopt -s nocaseglob
# Append to the Bash history file, rather than overwriting it
shopt -s histappend
# Autocorrect typos in path names when using `cd`
shopt -s cdspell
unset file
# Prefer US English and use UTF-8
export LC_ALL="en_US.UTF-8"
export LANG="en_US"
# Enable some Bash 4 features when possible:
# * `autocd`, e.g. `**/qux` will enter `./foo/bar/baz/qux`
# * Recursive globbing, e.g. `echo **/*.txt`
for option in autocd globstar; do
shopt -s "$option" 2> /dev/null
done
# 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)" scp sftp ssh
# Add `killall` tab completion for common apps
complete -o "nospace" -W "Contacts Calendar Dock Finder Mail Safari iTunes SystemUIServer Terminal Twitter" killall
# Add tab completion for `defaults read|write NSGlobalDomain`
# You could just use `-g` instead, but I like being explicit
complete -W "NSGlobalDomain" defaults
export EDITOR='subl -w'
export PATH=/usr/local/bin:$PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment