Skip to content

Instantly share code, notes, and snippets.

@chonthu
Created August 22, 2011 18:05
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 chonthu/1163054 to your computer and use it in GitHub Desktop.
Save chonthu/1163054 to your computer and use it in GitHub Desktop.
My Favorite PS1
alias bashp='subl ~/.bash_profile'
alias ll='ls -lhaG'
alias refresh='. ~/.bash_profile'
alias zend='sudo /usr/local/zend/bin/zendctl.sh'
alias sites='cd ~/Sites'
alias hubot='cd ~/Sites/hubot;bin/hubot'
alias subl='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl'
alias mongo_start='launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist'
# PS1 prompt color vars
RED="\[\033[1;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
WHITE="\[\033[0;37m\]"
PURPLE="\[\033[1;35m\]"
BLUE="\[\033[0;34m\]"
TIME="[\t]"
DIRNAME="\w"
# return branch name
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo " ("${ref#refs/heads/}"$(evil_git_dirty))"
}
# Returns "*" if the current git branch is dirty.
function evil_git_dirty {
[[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] && echo "*"
}
function shortpath {
# How many characters of the $PWD should be kept
local pwd_length=40
local lpwd="${PWD/#$HOME/~}"
if [ $(echo -n $lpwd | wc -c | tr -d " ") -gt $pwd_length ]
then newPWD="...$(echo -n $lpwd | sed -e "s/.*\(.\{$pwd_length\}\)/\1/")"
else newPWD="$(echo -n $lpwd)"
fi
echo $newPWD
}
export PS1="$GREEN""local $WHITE\$(shortpath)$RED\$(parse_git_branch)$YELLOW ⚡$WHITE "
export NODE_PATH="/usr/local/lib/node"
export PATH="/usr/local/bin:/usr/X11/bin:/usr/local/zend/bin:/usr/local/zend/mysql/bin:/usr/local/share/npm/bin:$PATH"
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/zend/lib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment