Created
May 23, 2013 19:31
-
-
Save stormbrew/5638776 to your computer and use it in GitHub Desktop.
This file contains 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
PS1_LASTEXIT='$(LE=$?; if [ ${LE} -ne 0 ]; then LED=$(perl -le "\$!+=${LE};print \$!"); echo "\[\e[31;1m\]^${LE}:${LED}\[\e[32;1m\]> "; fi)' | |
PS1_USERNAME="\[\e[37;1m\]\u\[\e[32;1m\]> " | |
PS1_JOBS='$(JB=$(jobs -l | wc -l); if [ ${JB} -gt 0 ]; then echo "\[\e[37;1m\]&\j\[\e[32;1m\]> "; fi)' | |
PS1_GIT='$(GPS=$(__git_ps1 %s); if [ -n "${GPS}" ]; then STAT=$(git status --porcelain | cut -c1-2 | sed -E "s/ /-/" | sort | uniq | xargs echo | cut --delimiter=" " -f1- --output-delimiter=","); echo "\[\e[37;1m\]git:${GPS}:\[\e[35;1m\]${STAT}\[\e[32;1m\]> "; fi)' | |
PS1_WD="\[\e[37;1m\]\w\[\e[32;1m\]> " | |
PS1_PROMPTNUM="\[\e[37;1m\]!\!\[\e[32;1m\]" | |
# \! in PS2 actually prints the next command number because the command so far has already been appended to the history. | |
# Instead, get it from fc, which can tell you the last command number. | |
PS2_PROMPTNUM="\[\e[37;1m\]!\$(fc -l -1 | head -1 | awk '{print \$1}')\[\e[32;1m\]" | |
export PS1="\n\[\e[32;1m\]|${PS1_LASTEXIT}${PS1_USERNAME}${PS1_JOBS}${PS1_WD}${PS1_GIT}\n\[\e[32;1m\]|${PS_PROMPTNUM}> \[\e[0m\]" | |
export PS2="\[\e[32;1m\]|${PS2_PROMPTNUM}: \[\e[0m\]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment