Created
February 13, 2012 06:03
-
-
Save noahhendrix/1814133 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
#functions | |
#is the branch dirty, if so echo a * | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
#if in a git repo echo branch name and dirty status | |
function parse_git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "("${ref#refs/heads/}"`parse_git_dirty`)" | |
} | |
# this makes tab-completion nicer, because it ignore | |
# case, so `cd co[TAB]` will complete to `cd Code` | |
bind 'set completion-ignore-case on' | |
# export PS1="$GREEN\w $YELLOW\$(parse_git_branch)$NO_COLOR → " | |
PS1="\[\033[1;32m\]\w \[\033[1;33m\]\$(parse_git_branch)\[\033[0m\] → " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment