Last active
December 20, 2015 19:29
-
-
Save bracke/6183725 to your computer and use it in GitHub Desktop.
.bash_profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add `~/bin` to the `$PATH` | |
export PATH="$HOME/bin:$PATH" | |
export PATH="/usr/local/bin:$PATH" | |
export PATH="/usr/local/sbin:$PATH" | |
# Load the shell dotfiles, and then some: | |
# * ~/.path can be used to extend `$PATH`. | |
# * ~/.extra can be used for other settings you don’t want to commit. | |
for file in ~/.{path,bash_prompt,exports,aliases,functions,extra}; do | |
[ -r "$file" ] && source "$file" | |
done | |
unset file | |
# Case-insensitive globbing (used in pathname expansion) | |
shopt -s nocaseglob | |
# Avoid succesive duplicates in the bash command history. | |
export HISTCONTROL=ignoredups | |
# Append to the Bash history file, rather than overwriting it | |
shopt -s histappend | |
# Append commands to the history every time a prompt is shown, | |
# instead of after closing the session. | |
PROMPT_COMMAND='history -a' | |
# Autocorrect typos in path names when using `cd` | |
shopt -s cdspell | |
# Add bash aliases. | |
if [ -f ~/.bash_aliases ]; then | |
source ~/.bash_aliases | |
fi | |
# 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 tab completion for `defaults read|write NSGlobalDomain` | |
# You could just use `-g` instead, but I like being explicit | |
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 && source ~/.git-completion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment