Skip to content

Instantly share code, notes, and snippets.

@grauwoelfchen
Created January 16, 2013 17:42
Show Gist options
  • Save grauwoelfchen/4549105 to your computer and use it in GitHub Desktop.
Save grauwoelfchen/4549105 to your computer and use it in GitHub Desktop.
zsh "spring" prompt
function git_prompt {
local branch branch_color head head_color
branch=`git symbolic-ref HEAD 2>/dev/null | cut -d'/' -f3`
if [[ -z $branch ]]; then
return
fi
if [[ -n `git status | grep "^nothing to"` ]]; then
branch_color="085"
else
branch_color="126"
fi
head=`git rev-parse --verify -q HEAD 2>/dev/null | cut -c 1-8`
head_color="229"
echo "%F{$branch_color}‹$branch›%f %F{$head_color}$head%f"
}
setopt prompt_subst
PROMPT='%F{029}« %m »%f %F{077}%~%f `git_prompt`
%F{219}%#%f '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment