Skip to content

Instantly share code, notes, and snippets.

@sbussard
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbussard/3e2748949e7a7566379b to your computer and use it in GitHub Desktop.
Save sbussard/3e2748949e7a7566379b to your computer and use it in GitHub Desktop.
Stable, fast and awesome looking PS1
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