-
-
Save Stqs/5451486 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 LC_ALL=en_US.UTF-8 | |
export CLICOLOR=1 | |
export LSCOLORS=GxFxCxDxBxegedabagaced | |
export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | |
txtund=$(tput sgr 0 1) # Underline | |
txtbld=$(tput bold) # Bold | |
reset='\[\e[00m\]' | |
bold='\[\e[01m\]' | |
red='\[\e[31m\]' | |
green='\[\e[32m\]' | |
orange='\[\e[33m\]' | |
blue='\[\e[34m\]' | |
purple='\[\e[35m\]' | |
cyan='\[\e[36m\]' | |
gray='\[\e[37m\]' | |
bright='\[\e[39m\]' | |
function short_pwd { | |
pwd=$(pwd) | |
first=$(basename $pwd) | |
rest=$(dirname $pwd) | |
second=$(basename $rest) | |
rest=$(dirname $rest) | |
third=$(basename $rest) | |
if [ $second = "/" ]; then | |
echo -n "/$first" | |
elif [ $third = "/" ]; then | |
echo -n "/$second/$first" | |
else | |
echo -n "$third/$second/$first" | |
fi | |
} | |
function myprompt { | |
git_top=$(git rev-parse --show-toplevel 2>/dev/null) | |
if [ $? -ne 0 ]; then | |
git_top="" | |
GIT=0 | |
else | |
git_top=$(basename $git_top) | |
GIT=1 | |
fi | |
if [ $GIT -ne 0 ]; then | |
git_branch=$(git branch | grep "*" | awk '{print $2}') | |
if [ $? -ne 0 ]; then | |
git_branch="" | |
fi | |
if [ $git_branch = "master" ]; then | |
branch="" | |
else | |
branch=" $bold$red($git_branch)$reset" | |
fi | |
fi | |
colordir="${bold}${blue}$(short_pwd)" | |
if [ $GIT -ne 0 ]; then | |
# We're in a git repo | |
EDITS=$(git status -s | wc -l | tr -d ' ') | |
if [ $EDITS -ne 0 ]; then | |
edits=" $bold$orange($EDITS)$reset" | |
else | |
edits="" | |
fi | |
AHEAD=$(git rev-list @{u}..HEAD 2>/dev/null | wc -l | tr -d ' ') | |
BEHIND=$(git rev-list HEAD..@{u} 2>/dev/null | wc -l | tr -d ' ') | |
if [ $AHEAD -ne 0 -a $BEHIND -eq 0 ]; then | |
ahead_behind="$bold$red +$AHEAD" | |
elif [ $BEHIND -ne 0 -a $AHEAD -eq 0 ]; then | |
ahead_behind="$bold$red -$BEHIND" | |
elif [ $AHEAD -eq 0 -a $BEHIND -eq 0 ]; then | |
ahead_behind="" | |
else | |
ahead_behind="$bold$red +$AHEAD -$BEHIND" | |
fi | |
git="${bold}${green}$git_top$edits$ahead_behind" | |
PS1="$git$branch $colordir$reset\$ " | |
else | |
PS1="$colordir$reset\$ " | |
fi | |
if [ $VIRTUAL_ENV ]; then | |
PS1="$bold$cyan$(basename $VIRTUAL_ENV)$reset $PS1" | |
fi | |
} | |
unset PS1 | |
if [ $USER = 'stqs' ]; then | |
PROMPT_COMMAND=myprompt | |
else | |
PS1='\u@\h$ ' | |
fi | |
### Added by the Heroku Toolbelt | |
export PATH="/usr/local/heroku/bin:$PATH" | |
export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future | |
# Setting PATH for Python 3.4 | |
# The orginal version is saved in .bash_profile.pysave | |
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}" | |
PATH="/Users/stqs/bin:$PATH" | |
export PATH | |
export GOPATH=$HOME/.go | |
export PATH=$PATH:$GOPATH/bin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment