Created
June 25, 2014 00:11
-
-
Save zipcode/131051fc509668f3fcb7 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
function setps1 { | |
export GIT_PS1_SHOWDIRTYSTATE=true | |
export GIT_PS1_SHOWUNTRACKEDFILES=true | |
# "(root) " in red if root | |
# Hostname (if SSH_TTY is set) | |
# Directory | |
# Git branch, if in git and available | |
# Last command exit status | |
# $ times shlvl, or # if root | |
export PS1='\ | |
$(s=$?; [ $UID -eq 0 ] && echo -e "\[\033[1;31m\](\u) \[\033[0;37m\]"; exit $s)\ | |
\[\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\]$(s=$?; seq -f "\$" -s "" 1 $SHLVL; exit $s)\[\033[0;0m\] \ | |
' | |
} | |
setps1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment