Skip to content

Instantly share code, notes, and snippets.

@zipcode
Last active January 3, 2016 12:59
Show Gist options
  • Save zipcode/8466691 to your computer and use it in GitHub Desktop.
Save zipcode/8466691 to your computer and use it in GitHub Desktop.
function setps1 {
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
# Hostname (if SSH_TTY is set)
# Directory
# Git branch
# Last command exit status
# $
export PS1='\
\[\033[0;32m\]${SSH_TTY:+"\h "}\
\[\033[0;36m\]\W\[\033[0m\]\
$(s=$?; declare -F __git_ps1 >/dev/null && __git_ps1 " \[\033[1;32m\]%s\[\033[0m\]"; exit $s)\
\[\033[1;31m\]${?/#0}\
\[\033[0;33m\]\$\[\033[0;37m\] \
'
}
setps1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment