Created
July 25, 2012 23:17
-
-
Save stilist/3179287 to your computer and use it in GitHub Desktop.
.bash_profile
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
export SHELL=/bin/bash | |
# system paths | |
export PATH=/usr/local/bin:/bin:/usr/sbin:/sbin:$HOME/bin:$PATH | |
# MySQL | |
export PATH="/usr/local/mysql/bin:$PATH" | |
# node.js | |
export NODE_PATH="$HOME/local/node:$HOME/local/node/lib/node_modules" | |
export PATH="$HOME/local/node/bin:$PATH" | |
# PostgreSQL | |
# http://nextmarvel.net/blog/2011/09/brew-install-postgresql-on-os-x-lion/ | |
BREW_POSTGRES_DIR=`brew info postgres | awk '{print $1"/bin"}' | grep "/postgresql/"` | |
export PATH="$BREW_POSTGRES_DIR:$PATH" | |
# Python | |
export PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH" | |
# Ruby | |
export PATH="$HOME/.gem/ruby/1.8/bin:$PATH" | |
# RVM | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" | |
# keep history | |
export HISTCONTROL=erasedups | |
export HISTSIZE=100000 | |
export EDITOR=nano | |
shopt -s histappend | |
# make `rm` move file into the Trash | |
# http://hints.macworld.com/article.php?story=20080224175659423 | |
function rm () { | |
local path | |
for path in "$@"; do | |
# ignore any arguments | |
if [[ "$path" = -* ]]; then : | |
else | |
local dst=${path##*/} | |
# append the time if necessary | |
while [ -e ~/.Trash/"$dst" ]; do | |
dst="$dst "$(date +%H-%M-%S) | |
done | |
mv "$path" ~/.Trash/"$dst" | |
fi | |
done | |
} | |
function parse_git_branch { | |
# http://asemanfar.com/Current-Git-Branch-in-Bash-Prompt | |
git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)#\1#' | |
} | |
function generate_ps1 { | |
# http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html | |
local red="\[\e[31m\]" | |
local green="\[\e[32m\]" | |
local yellow="\[\e[1;33m\]" | |
local cyan="\[\e[36m\]" | |
local light_gray="\[\e[37m\]" | |
local blank="\[\e[0m\]" | |
local username="$cyan\u$blank" | |
local at="$light_gray@$blank" | |
local machine="$green\h$blank" | |
local colon="$light_gray:$blank" | |
local path="$red\w$blank" | |
local git_branch="\$(parse_git_branch)" | |
local prompt=" $light_gray\$$blank " | |
local branch="" | |
if [ "$git_branch" ] ; then | |
branch=$git_branch | |
fi | |
if [ "$branch" ] ; then | |
branch=" $yellow[$branch]$blank" | |
fi | |
echo "\n$username$at$machine$colon$path$branch$prompt" | |
} | |
export PS1=$(generate_ps1) | |
# http://stackoverflow.com/questions/6796982/clang-and-the-default-compiler-in-os-x-lion | |
# Set Clang as the default compiler for the system | |
export CC=clang | |
export CFLAGS=-Qunused-arguments | |
export CPPFLAGS=-Qunused-arguments | |
# Set LLVM GCC as the default compiler for the system | |
# export CPP='llvm-gcc-4.2' | |
# export CC='llvm-gcc-4.2' | |
# export CXX='llvm-g++' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment