Skip to content

Instantly share code, notes, and snippets.

@acoffman
Created May 23, 2012 12:21
Show Gist options
  • Save acoffman/2774957 to your computer and use it in GitHub Desktop.
Save acoffman/2774957 to your computer and use it in GitHub Desktop.
#prompt
function parse_git_deleted {
[[ $(git status 2> /dev/null | grep deleted:) != "" ]] && echo "-"
}
function parse_git_added {
[[ $(git status 2> /dev/null | grep "Untracked files:") != "" ]] && echo '+'
}
function parse_git_modified {
[[ $(git status 2> /dev/null | grep modified:) != "" ]] && echo "*"
}
function parse_git_dirty {
echo "$(parse_git_added)$(parse_git_modified)$(parse_git_deleted)"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
export PS1="
╭─\[$(tput sgr0)\]( \[$(tput setaf 4)\]\w\[$(tput sgr0)\] as \[$(tput setaf 2)\]\u\[$(tput sgr0)\] at \[$(tput setaf 6)\]\h\[$(tput sgr0)\] ) \[$(tput setaf 5)\]\$(parse_git_branch)\[$(tput sgr0)\]
╰─\[$(tput bold)\]\[$(tput setaf 1)\]⚡\[$(tput sgr0)\] "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment