1 # ~/.bashrc: executed by bash(1) for non-login shells.
3 # If not running interactively, don't do anything
9 # don't put duplicate lines in the history. See bash(1) for more options
10 # don't overwrite GNU Midnight Commander's setting of `ignorespace'.
11 export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
12 # ... or force ignoredups and ignorespace
13 export HISTCONTROL=ignoreboth
15 # append to the history file, don't overwrite it
18 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
20 # check the window size after each command and, if necessary,
21 # update the values of LINES and COLUMNS.
24 # If set, the pattern "**" used in a pathname expansion context will
25 # match all files and zero or more directories and subdirectories.
28 # make less more friendly for non-text input files, see lesspipe(1)
29 [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
34 # set variable identifying the chroot you work in (used in the prompt below)
35 if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
36 debian_chroot=$(cat /etc/debian_chroot)
39 # enable color support of ls and also add handy aliases
40 if [ -x /usr/bin/dircolors ]; then
42 alias ls='ls --color=auto'
43 alias dir='dir --color=auto'
44 alias vdir='vdir --color=auto'
46 alias grep='grep --color=auto'
47 alias fgrep='fgrep --color=auto'
48 alias egrep='egrep --color=auto'
51 alias emacs='emacs -nw'
52 alias serve='python -m SimpleHTTPServer 8080'
56 # Enable programmable completion features (you don't need to enable
57 # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
58 # sources /etc/bash.bashrc).
59 if [ -f /etc/bash_completion ]; then
60 . /etc/bash_completion
63 # Add the ~/bin directory to the path. This allows you to install simple
64 # binaries by simply moving them into ~/bin.
65 if [ -d $HOME/bin ]; then
66 PATH="$HOME/bin:$PATH"
70 # Put $HOME/.cabal/bin on the path. Installing cabal doesn't
71 # automatically put installed packages on the path.
72 if [ -d $HOME/.cabal/bin ]; then
73 PATH="$HOME/.cabal/bin:$PATH"
77 # Put /usr/local/bin (where homebrew installs stuff) before /usr/bin on the
78 # path. This means that if a program exists at both locations, calls to that
79 # program will use the homebrew version rather than the system version.
80 PATH="/usr/local/bin:$PATH"
83 # Run a machine-specific bashrc (if it exists).
84 if [ -f $HOME/.bashrc_local ]; then
85 source $HOME/.bashrc_local
88 # Install RVM if it's not installed.
89 if [ ! -f $HOME/.rvm/scripts/rvm ]; then
90 bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
93 # Load RVM into shell session.
94 [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
96 # Automatically open screen.
97 # The if statement prevents it from recursing (since screen opens bash).
98 if [ $TERM != screen ]; then
102 # Gets a directory named .env if it exists in the currend directory or any of its parents
104 if [ -d "$1/.env" ] ; then
107 if [ -d "$1/.." ] ; then
114 # Load a virtualenv environment if it exists in a file named .env
115 env_folder=$(get_env $(pwd))
117 if [ -d "$env_folder" ] ; then
118 if [[ $VIRTUAL_ENV != $env_folder ]] ; then
119 echo "Activating env '$env_folder'"
120 source "$env_folder/bin/activate"
123 if [ -d "$VIRTUAL_ENV" ] ; then
132 # Call on_prompt() every time the command prompt executes
133 PROMPT_COMMAND=on_prompt