Created
November 17, 2014 09:27
-
-
Save leeferwagen/1049aea16bd94a93a62c 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 FC31="\[\033[31m\]" | |
export FC32="\[\033[32m\]" | |
export FC33="\[\033[33m\]" | |
export FC34="\[\033[34m\]" | |
export FC35="\[\033[35m\]" | |
export FC36="\[\033[36m\]" | |
export FC37="\[\033[37m\]" | |
export FC38="\[\033[38m\]" | |
export FC39="\[\033[39m\]" | |
export FC5="\[\033[5m\]" | |
export FC0="\[\033[0m\]" | |
if [ "$TERM" = "linux" ]; then | |
export MP_CHECK_GLYPH="v" | |
export MP_STAR_GLYPH="*" | |
export MP_GIT_ADDED_GLYPH="+" | |
export MP_GIT_MODIFIED_GLYPH="M" | |
export MP_GIT_DELETED_GLYPH="D" | |
export MP_ARROW_RIGHT_BOLD=">>" | |
export MP_ARROW_RIGHT_THIN="->" | |
else | |
export MP_CHECK_GLYPH="✔" | |
export MP_STAR_GLYPH="✻" | |
export MP_GIT_ADDED_GLYPH="+" | |
export MP_GIT_MODIFIED_GLYPH="✎" | |
export MP_GIT_DELETED_GLYPH="✂" | |
export MP_ARROW_RIGHT_BOLD="➤" | |
export MP_ARROW_RIGHT_THIN="➙" | |
fi | |
pwd() { | |
echo -e "\033[1A \033[32m\033[5m${MP_ARROW_RIGHT_BOLD} \033[0m\033[33mWorking directory is \033[36m$(/bin/pwd)\033[39m" | |
} | |
my-prompt() { | |
PS1='' | |
if [ -d ".git" ]; then | |
PS1="${PS1}${FC33}$(/bin/pwd | xargs basename)" | |
PS1="${PS1}${FC36} ${MP_STAR_GLYPH} ${FC33}$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')" | |
if git status | grep -q 'nothing to commit'; then | |
PS1="${PS1}${FC32} ${MP_CHECK_GLYPH} " | |
else | |
PS1="${PS1}${FC36} ${MP_GIT_ADDED_GLYPH} ${FC37}$(git status --porcelain | grep '? ' | wc -l)" | |
PS1="${PS1}${FC36} ${MP_GIT_MODIFIED_GLYPH} ${FC33}$(git status --porcelain | grep 'M ' | wc -l)" | |
PS1="${PS1}${FC36} ${MP_GIT_DELETED_GLYPH} ${FC31}$(git status --porcelain | grep 'D ' | wc -l)" | |
fi | |
else | |
PS1="${FC33}\u ${FC36}${MP_STAR_GLYPH} ${FC33}\h ${FC36}${MP_ARROW_RIGHT_THIN} ${FC33}\w" | |
fi | |
PS1="${PS1}\n${FC32} ${MP_ARROW_RIGHT_BOLD} ${FC39}" | |
} | |
PROMPT_COMMAND='my-prompt' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment