Skip to content

Instantly share code, notes, and snippets.

@bikashp
Created March 17, 2011 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bikashp/873851 to your computer and use it in GitHub Desktop.
Save bikashp/873851 to your computer and use it in GitHub Desktop.
PS1="\W $ "
export PATH="/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:$PATH"
export JAVA_HOME='/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home'
export EDITOR='mate -w'
# my aliases
alias ll='ls -la'
alias e='mate . &'
alias ebash='mate ~/.bash_login &'
alias rbash='source ~/.bash_login'
alias ehosts='sudo mate /private/etc/hosts'
alias rhosts='lookupd -flushcache'
alias h='history'
alias c='clear'
alias ..='cd ..'
alias ...='cd ../..'
# X11
export DISPLAY=:0.0 Git tab completion
#source /usr/local/etc/bash_completion.d/git-completion.bash
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUPSTREAM="auto"
export GIT_PS1_SHOWSTASHSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
# PS1='\[\e[0;32m\][\w]$(__git_ps1 " %s")\n\u@\h$\[\e[m\] '
PS1='\[\033[1;33m\]\u\[\033[0m\]@\[\033[1;33m\]\h \[\033[0m\]\w\[\033[1;33m\]$(__git_ps1 " %s")\[\033[0m\] \$ '
# Git Branch and Status on Terminal
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[1;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
function parse_git_branch {
git rev-parse --git-dir &> /dev/null
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="${RED}☹"
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="${YELLOW}☝"
else
remote="${YELLOW}☟"
fi
fi
if [[ ${git_status} =~ ${diverge_pattern} ]]; then
remote="${YELLOW}↕"
fi
if [[ ${git_status} =~ ${branch_pattern} ]]; then
branch=${BASH_REMATCH[1]}
echo " (${branch})${remote}${state}"
fi
}
function prompt_func() {
previous_return_value=$?;
# prompt="${TITLEBAR}$BLUE[$RED\w$GREEN$(__git_ps1)$YELLOW$(git_dirty_flag)$BLUE]$COLOR_NONE "
prompt="${TITLEBAR}${BLUE}[${RED}\w${GREEN}$(parse_git_branch)${BLUE}]${COLOR_NONE} "
if test $previous_return_value -eq 0
then
PS1="${prompt}"
else
PS1="${prompt}${RED})${COLOR_NONE} "
fi
#Display ruby interpreter used via rvm
PS1="\$(~/.rvm/bin/rvm-prompt) $PS1"
}
PROMPT_COMMAND=prompt_func
alias gitx="open -a '/Applications/GitX.app'"
alias mongo-hub="open -a '/Applications/MongoHub.app'"
alias gst="git status"
alias gco="git checkout"
alias gci="git commit"
alias gb="git branch"
alias ga="git add ."
alias gdif="git diff"
alias c="clear"
alias l="ls -al"
alias cf="cd ~/Dev/cloudfactory/"
source ~/.bashrc
# export JAVA_HOME=`/usr/libexec/java_home`
export MTURK_CMD_HOME="/Users/sts-110/SDKs/aws-mturk-clt-1.3.0"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment