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 # make less more friendly for non-text input files, see lesspipe(1)
25 [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
30 # set variable identifying the chroot you work in (used in the prompt below)
31 if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
32 debian_chroot=$(cat /etc/debian_chroot)
35 # enable color support of ls and also add handy aliases
36 if [ -x /usr/bin/dircolors ]; then
38 alias ls='ls --color=auto'
39 alias dir='dir --color=auto'
40 alias vdir='vdir --color=auto'
42 alias grep='grep --color=auto'
43 alias fgrep='fgrep --color=auto'
44 alias egrep='egrep --color=auto'
47 alias emacs='emacs -nw'
48 alias serve='python -m SimpleHTTPServer 8080'
54 # Enable programmable completion features (you don't need to enable
55 # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
56 # sources /etc/bash.bashrc).
57 if [ -f /etc/bash_completion ]; then
58 . /etc/bash_completion
61 # Add the ~/bin directory to the path. This allows you to install simple
62 # binaries by simply moving them into ~/bin.
63 if [ -d $HOME/bin ]; then
64 PATH="$HOME/bin:$PATH"
68 # Put $HOME/.cabal/bin on the path. Installing cabal doesn't
69 # automatically put installed packages on the path.
70 if [ -d $HOME/.cabal/bin ]; then
71 PATH="$HOME/.cabal/bin:$PATH"
75 # Put /usr/local/bin (where homebrew installs stuff) before /usr/bin on the
76 # path. This means that if a program exists at both locations, calls to that
77 # program will use the homebrew version rather than the system version.
78 PATH="/usr/local/bin:$PATH"
81 # Automatically open screen.
82 # The if statement prevents it from recursing (since screen opens bash).
83 if [ $TERM != screen ]; then
87 # Gets a directory named .env if it exists in the currend directory or any of its parents
89 if [ -d "$1/.env" ] ; then
92 if [ -d "$1/.." ] ; then
99 # Load a virtualenv environment if it exists in a file named .env
100 env_folder=$(get_env $(pwd))
102 if [ -d "$env_folder" ] ; then
103 if [[ $VIRTUAL_ENV != $env_folder ]] ; then
104 echo "Activating env '$env_folder'"
105 source "$env_folder/bin/activate"
108 if [ -d "$VIRTUAL_ENV" ] ; then
117 # Call on_prompt() every time the command prompt executes
118 PROMPT_COMMAND=on_prompt
120 # pip should only run if there is a virtualenv currently activated
121 export PIP_REQUIRE_VIRTUALENV=true