2012-10-10 14:05:57 +00:00
|
|
|
# Don't put duplicate lines in the history
|
2012-10-12 08:53:13 +00:00
|
|
|
export HISTCONTROL=ignoreboth:erasedups
|
2012-10-10 14:05:57 +00:00
|
|
|
|
|
|
|
# Set history length
|
|
|
|
HISTFILESIZE=1000000000
|
|
|
|
HISTSIZE=1000000
|
|
|
|
|
|
|
|
# Append to the history file, don't overwrite it
|
|
|
|
shopt -s histappend
|
2012-10-12 08:53:13 +00:00
|
|
|
# Check the window size after each command and, if necessary, update the values of LINES and COLUMNS
|
2012-10-10 14:05:57 +00:00
|
|
|
shopt -s checkwinsize
|
|
|
|
# Autocorrect typos in path names when using `cd`
|
|
|
|
shopt -s cdspell
|
|
|
|
# Save all lines of a multiple-line command in the same history entry (allows easy re-editing of multi-line commands)
|
|
|
|
shopt -s cmdhist
|
2012-10-12 08:53:13 +00:00
|
|
|
# Do not autocomplete when accidentally pressing Tab on an empty line. (It takes forever and yields "Display all 15 gazillion possibilites?")
|
2012-12-12 11:18:25 +00:00
|
|
|
shopt -s no_empty_cmd_completion
|
2012-10-12 08:53:13 +00:00
|
|
|
|
|
|
|
# Do not overwrite files when redirecting using ">". Note that you can still override this with ">|"
|
2012-12-12 11:18:25 +00:00
|
|
|
set -o noclobber
|
2012-10-10 14:05:57 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2012-10-12 08:53:13 +00:00
|
|
|
# Locale
|
|
|
|
export LC_ALL=en_US.UTF-8
|
|
|
|
export LANG="en_US"
|
|
|
|
|
2014-04-30 12:19:29 +00:00
|
|
|
# Set the composer home.
|
|
|
|
export COMPOSER_HOME="$HOME/.composer"
|
2012-12-13 12:26:57 +00:00
|
|
|
|
|
|
|
# Prepend $PATH without duplicates
|
|
|
|
function _prepend_path() {
|
|
|
|
if ! $( echo "$PATH" | tr ":" "\n" | grep -qx "$1" ) ; then
|
|
|
|
PATH="$1:$PATH"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-10-29 09:03:07 +00:00
|
|
|
# Construct $PATH
|
2014-05-02 22:45:04 +00:00
|
|
|
PATH="/usr/bin:/bin:/usr/sbin:/sbin"
|
2014-04-17 19:53:30 +00:00
|
|
|
[ -d /usr/texbin ] && _prepend_path "/usr/texbin"
|
|
|
|
[ -d /usr/local/sbin ] && _prepend_path "/usr/local/sbin"
|
2012-12-13 12:26:57 +00:00
|
|
|
[ -d /usr/local/bin ] && _prepend_path "/usr/local/bin"
|
|
|
|
command -v brew >/dev/null 2>&1 && _prepend_path "$(brew --prefix coreutils)/libexec/gnubin"
|
2014-05-02 22:45:04 +00:00
|
|
|
[ -d $HOME/bin ] && _prepend_path "$HOME/bin"
|
2015-01-27 11:27:49 +00:00
|
|
|
[ -d $HOME/dotfiles/bin ] && _prepend_path "$HOME/dotfiles/bin"
|
|
|
|
[ -d "$COMPOSER_HOME/vendor/bin" ] && _prepend_path "$COMPOSER_HOME/vendor/bin"
|
|
|
|
_prepend_path "./vendor/bin"
|
2012-10-15 11:14:21 +00:00
|
|
|
export PATH
|
|
|
|
|
2012-12-12 12:52:29 +00:00
|
|
|
# Colors
|
|
|
|
RED="$(tput setaf 1)"
|
|
|
|
GREEN="$(tput setaf 2)"
|
|
|
|
YELLOW="$(tput setaf 3)"
|
|
|
|
BLUE="$(tput setaf 4)"
|
|
|
|
MAGENTA="$(tput setaf 5)"
|
|
|
|
CYAN="$(tput setaf 6)"
|
|
|
|
WHITE="$(tput setaf 7)"
|
|
|
|
GRAY="$(tput setaf 8)"
|
|
|
|
BOLD="$(tput bold)"
|
|
|
|
UNDERLINE="$(tput sgr 0 1)"
|
|
|
|
INVERT="$(tput sgr 1 0)"
|
|
|
|
NOCOLOR="$(tput sgr0)"
|
|
|
|
|
2014-03-07 09:44:45 +00:00
|
|
|
# vim is default editor
|
|
|
|
export EDITOR=`which vim`
|
|
|
|
|
2012-10-15 11:14:21 +00:00
|
|
|
# Load prompt and aliases
|
2014-06-25 16:10:23 +00:00
|
|
|
for file in ~/dotfiles/includes/bash_{prompt,aliases,functions,git,completion}.bash; do
|
2012-12-14 16:01:18 +00:00
|
|
|
[ -r "$file" ] && source "$file"
|
2012-10-15 11:00:57 +00:00
|
|
|
done
|
|
|
|
unset file
|
|
|
|
|
2014-09-25 07:57:20 +00:00
|
|
|
if [ `uname` == 'Darwin' ]; then
|
|
|
|
export GOROOT="/usr/local/Cellar/go/1.3/libexec"
|
|
|
|
export GOPATH=$HOME/go
|
|
|
|
|
|
|
|
launchctl setenv GOROOT $GOROOT
|
|
|
|
launchctl setenv GOPATH $GOPATH
|
|
|
|
fi
|
|
|
|
|
2012-10-10 14:05:57 +00:00
|
|
|
# Tell ls to be colourful
|
|
|
|
export CLICOLOR=1
|
|
|
|
|
|
|
|
# Tell grep to highlight matches
|
|
|
|
export GREP_OPTIONS='--color=auto'
|
2012-10-12 08:53:13 +00:00
|
|
|
|
|
|
|
# Make less the default pager, and specify some useful defaults.
|
|
|
|
less_options=(
|
|
|
|
# If the entire text fits on one screen, just show it and quit. (Be more
|
|
|
|
# like "cat" and less like "more".)
|
|
|
|
--quit-if-one-screen
|
|
|
|
|
|
|
|
# Do not clear the screen first.
|
|
|
|
--no-init
|
|
|
|
|
|
|
|
# Like "smartcase" in Vim: ignore case unless the search pattern is mixed.
|
|
|
|
--ignore-case
|
|
|
|
|
|
|
|
# Do not automatically wrap long lines.
|
|
|
|
--chop-long-lines
|
|
|
|
|
|
|
|
# Allow ANSI colour escapes, but no other escapes.
|
|
|
|
--RAW-CONTROL-CHARS
|
|
|
|
|
|
|
|
# Do not ring the bell when trying to scroll past the end of the buffer.
|
|
|
|
--quiet
|
|
|
|
|
|
|
|
# Do not complain when we are on a dumb terminal.
|
|
|
|
--dumb
|
|
|
|
);
|
2012-12-13 12:26:57 +00:00
|
|
|
export LESS="${less_options[*]}"
|
|
|
|
unset less_options
|
|
|
|
export PAGER='less'
|
2012-10-19 11:54:20 +00:00
|
|
|
|
|
|
|
# Load extra (private) settings
|
2013-02-04 10:32:58 +00:00
|
|
|
[ -f ~/.bashlocal ] && source ~/.bashlocal
|
2014-05-02 22:45:04 +00:00
|
|
|
|
|
|
|
# Force a green prompt
|
|
|
|
true
|