Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
dotfiles/.bashrc
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
70 lines (60 sloc)
2.11 KB
This file contains 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
. ~/bin/bash_colors.sh | |
# Add paths that should have been there by default | |
export PATH=${PATH}:/usr/local/bin | |
export PATH="~/bin:$PATH" | |
export PATH="$PATH:~/.gem/ruby/1.8/bin" | |
# Add postgres to the path | |
export PATH=$PATH:/usr/local/pgsql/bin | |
export PATH=$PATH:/Library/PostgreSQL/8.3/bin | |
# Unbreak broken, non-colored terminal | |
export TERM='xterm-color' | |
alias ls='ls -G' | |
alias ll='ls -lG' | |
export LSCOLORS="ExGxBxDxCxEgEdxbxgxcxd" | |
export GREP_OPTIONS="--color" | |
# Erase duplicates in history | |
export HISTCONTROL=erasedups | |
# Store 10k history entries | |
export HISTSIZE=10000 | |
# Append to the history file when exiting instead of overwriting it | |
shopt -s histappend | |
# Git prompt components | |
function minutes_since_last_commit { | |
now=`date +%s` | |
last_commit=`git log --pretty=format:'%at' -1` | |
seconds_since_last_commit=$((now-last_commit)) | |
minutes_since_last_commit=$((seconds_since_last_commit/60)) | |
echo $minutes_since_last_commit | |
} | |
grb_git_prompt() { | |
local g="$(__gitdir)" | |
if [ -n "$g" ]; then | |
local MINUTES_SINCE_LAST_COMMIT=`minutes_since_last_commit` | |
if [ "$MINUTES_SINCE_LAST_COMMIT" -gt 30 ]; then | |
local COLOR=${RED} | |
elif [ "$MINUTES_SINCE_LAST_COMMIT" -gt 10 ]; then | |
local COLOR=${YELLOW} | |
else | |
local COLOR=${GREEN} | |
fi | |
local SINCE_LAST_COMMIT="${COLOR}$(minutes_since_last_commit)m${NORMAL}" | |
# The __git_ps1 function inserts the current git branch where %s is | |
local GIT_PROMPT=`__git_ps1 "(%s|${SINCE_LAST_COMMIT})"` | |
echo ${GIT_PROMPT} | |
fi | |
} | |
PS1="\h:\W\$(grb_git_prompt) \u\$ " | |
activate_virtualenv() { | |
if [ -f env/bin/activate ]; then . env/bin/activate; | |
elif [ -f ../env/bin/activate ]; then . ../env/bin/activate; | |
elif [ -f ../../env/bin/activate ]; then . ../../env/bin/activate; | |
elif [ -f ../../../env/bin/activate ]; then . ../../../env/bin/activate; | |
fi | |
} | |
python_module_dir () { | |
echo "$(python -c "import os.path as _, ${1}; \ | |
print _.dirname(_.realpath(${1}.__file__[:-1]))" | |
)" | |
} | |
source ~/bin/git-completion.bash | |
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting | |