Created
May 8, 2012 20:32
-
-
Save efroese/2639039 to your computer and use it in GitHub Desktop.
eriks 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
# .bash_profile | |
# set -xv | |
##################################################### | |
# each shell appends to history | |
shopt -s histappend | |
PROMPT_COMMAND='history -a' | |
export HISTFILESIZE=1000000000 | |
##################################################### | |
# Terminal stuff | |
function parse_git_branch { | |
[ -d .git ] || return 1 | |
git_status="$(git status 2> /dev/null)" | |
branch_pattern="^# On branch ([^${IFS}]*)" | |
remote_pattern="# Your branch is (.*) of" | |
diverge_pattern="# Your branch and (.*) have diverged" | |
if [[ ! ${git_status}} =~ "working directory clean" ]]; then | |
state="*" | |
fi | |
# add an else if or two here if you want to get more specific | |
if [[ ${git_status} =~ ${remote_pattern} ]]; then | |
if [[ ${BASH_REMATCH[1]} == "ahead" ]]; then | |
remote="↑" | |
elif [ ${BASH_REMATCH[1]} == "behind" ]]; then | |
remote="↓" | |
fi | |
fi | |
if [[ ${git_status} =~ ${diverge_pattern} ]]; then | |
remote="↕" | |
fi | |
if [[ ${git_status} =~ ${branch_pattern} ]]; then | |
branch=${BASH_REMATCH[1]} | |
echo " (${branch}${state}${remote})" | |
fi | |
} | |
# Colored ls output | |
export CLICOLOR=1 | |
export LSCOLORS=dxfxcxdxbxegedabagacad | |
# export TERM="xterm-color" | |
export EDITOR=vi | |
#set -o vi | |
# Turn off the bell | |
# xset b 0 | |
BLUE="\[\033[0;34m\]" | |
CYAN="\[\033[0;36m\]" | |
GREEN="\[\033[0;32m\]" | |
RED="\[\033[0;31m\]" | |
LIGHT_RED="\[\033[0;31m\]" | |
MAGENTA="\[\033[0;35m\]" | |
YELLOW="\[\033[0;33m\]" | |
WHITE="\[\033[1;37m\]" | |
ENDCOLOR="\[\033[0m\]" | |
COLOR1=$CYAN | |
COLOR2=$GREEN | |
COLOR3=$CYAN | |
if [ $UID = 0 ]; then | |
# I am root | |
COLOR2="\[\033[0;31m\]" | |
fi | |
LONG_PROMPT="$COLOR2($COLOR3\u@$RED\h$COLOR2)\ | |
-($COLOR1$(date +%d-%b-%y)$COLOR2) \ | |
$COLOR2($COLOR3\#$COLOR2) \ | |
$COLOR2($COLOR3\w$COLOR2)$(parse_git_branch)\n \ | |
$COLOR1\$$ENDCOLOR " | |
NODATE_PROMPT="$COLOR2($COLOR3\u@$RED\h$COLOR2)\ | |
$COLOR2($COLOR3\#$COLOR2) \ | |
$COLOR2($COLOR3\w$COLOR2)$(parse_git_branch)\n \ | |
$COLOR1\$$ENDCOLOR " | |
SHORT_PROMPT="$COLOR2($COLOR3\u@$RED\h$COLOR2) \ | |
$COLOR2($COLOR3\w$COLOR2)$(parse_git_branch) \n \ | |
$COLOR1\$$ENDCOLOR " | |
export PS1=$SHORT_PROMPT | |
function prompt_func(){ | |
PS1="$COLOR2($COLOR3\u@$RED\h$COLOR2) \ | |
$COLOR2($COLOR3\w$COLOR2)$(parse_git_branch) \n \ | |
$COLOR1\$$ENDCOLOR " | |
} | |
PROMPT_COMMAND=prompt_func | |
#################################################### | |
export MAVEN_OPTS='-Xms256m -Xmx512m -XX:PermSize=256m -XX:MaxPermSize=512m' | |
#################################################### | |
# Paths | |
export MANPATH=/usr/share/man:/usr/local/man:$MANPATH | |
APP_LOCAL=$HOME/Applications | |
PATH=$PATH:$APP_LOCAL:/$APP_LOCAL/bin:/usr/local/bin | |
LOCAL=$HOME/Applications | |
MAVEN_HOME=$LOCAL/maven | |
PATH=$MAVEN_HOME/bin:$PATH | |
MYSQL_HOME=/usr/local/mysql | |
PATH=$MYSQL_HOME/bin:$PATH | |
MONGO_HOME=/usr/local/mongo | |
PATH=$MONGO_HOME/bin:$PATH | |
JYTHON_HOME=$HOME/Applications/jython | |
PATH=$JYTHON_HOME/bin:$PATH | |
PATH=/Developer/usr/bin:$PATH | |
PATH=$HOME/work/drush:$PATH | |
export PATH | |
################################################### | |
export GROUPER_HOME=$HOME/Applications/grouper | |
################################################### | |
# Git | |
export SAK_MVN_OPTS=" -Dmaven.repo.local=/Users/froese/work/sakaiproject/.m2/repository " | |
export RSMART_MVN_OPTS=" -Dmaven.repo.local=/Users/froese/work/rsmart/.m2/repository " | |
alias git-svn="git svn" | |
alias gst="git status" | |
################################################### | |
# Java | |
alias javad="java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044 " | |
alias javads="java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044 " | |
alias neweclipse="open -n /Applications/eclipse/Eclipse.app" | |
################################################### | |
# aliases | |
alias ll="ls -l" | |
alias la="ls -a" | |
alias lla="ls -al" | |
alias lr="ls -Rl" | |
alias mkdir="mkdir -p" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment