Last active
August 29, 2015 14:18
-
-
Save sbussard/3e2748949e7a7566379b to your computer and use it in GitHub Desktop.
Stable, fast and awesome looking PS1
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
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
promptFunc() { | |
COOL_COLOR="\[\e[38;5;25m\]" | |
REPO_FORMAT="\[\e[48;5;233m\]" | |
DIM="\[\e[2m\]" | |
UNFORMAT="\[\e[0m\]" | |
base="" # absolute path to where you keep your repos | |
dir=`pwd` | |
dir=${dir#$base} | |
if [ ${dir::1} != "/" ]; then | |
#repo=${dir%%/*} | |
#path=${dir#*/} | |
dir="${REPO_FORMAT} $dir ${UNFORMAT}" | |
fi | |
PS1="${COOL_COLOR}∵${UNFORMAT} $dir${DIM}$(parse_git_branch)${UNFORMAT} ${COOL_COLOR}∴${UNFORMAT} " | |
} | |
PROMPT_COMMAND=promptFunc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment