Skip to content

Instantly share code, notes, and snippets.

@minism
Last active December 11, 2015 04:59
Show Gist options
  • Save minism/4549305 to your computer and use it in GitHub Desktop.
Save minism/4549305 to your computer and use it in GitHub Desktop.
# Returns "*" if the current git branch is dirty.
_parse_git_dirty()
{
[[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] && echo "*"
}
# Get the current git branch name (if available)
_git_prompt()
{
local ref=$(git symbolic-ref HEAD 2>/dev/null | cut -d'/' -f3)
if [ "$ref" != "" ]; then
echo "($ref$(_parse_git_dirty)) "
fi
}
_screen_prompt()
{
if [ "${WINDOW}" != "" ]; then
echo "[$WINDOW] "
fi
}
alias ls='ls -FG'
alias grep='egrep --color=auto'
export CLICOLOR=1
export PS1="\$(type -t _screen_prompt > /dev/null && _screen_prompt)\[\033[0;32m\]\u@\h\[\033[0m\] \[\033[0;36m\]\w\[\033[0m\] \[\033[0;33m\]\$(type -t _git_prompt > /dev/null && _git_prompt)\[\033[0;31m\]\[\033[0m\]% "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment