Created
February 20, 2012 09:45
-
-
Save syohex/1868600 to your computer and use it in GitHub Desktop.
display stash number if stash >= 1
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
## show git branch at right prompt | |
autoload -Uz vcs_info | |
zstyle ':vcs_info:*' formats '[%b]' | |
zstyle ':vcs_info:*' actionformats '(%s)-[%b|%a]' | |
precmd () { | |
psvar=() | |
LANG=en_US.UTF-8 vcs_info | |
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_" | |
topdir=`git rev-parse --show-toplevel 2>/dev/null` | |
if [ $? -eq 0 ] | |
then | |
stashes=$(git stash list 2>/dev/null | wc -l) | |
if [ ${stashes} -eq 0 ] | |
then | |
psvar[2]="" | |
else | |
psvar[2]=" @${stashes// /}" | |
fi | |
fi | |
} | |
_DIRPART=%B%{$fg[cyan]%}'[%(5~,%-2~/.../%2~,%~)]'%{$reset_color%}%b | |
RPROMPT=%B"%1(v|%F{magenta}%1v%f%F{yellow}%2v%f|)"%b${_DIRPART} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment