Skip to content

Instantly share code, notes, and snippets.

@yoko
Created February 16, 2012 16:08
Show Gist options
  • Save yoko/1846104 to your computer and use it in GitHub Desktop.
Save yoko/1846104 to your computer and use it in GitHub Desktop.
# http://d.hatena.ne.jp/mollifier/20100906/p1
autoload -Uz add-zsh-hook
autoload -Uz colors
colors
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn hg bzr
zstyle ':vcs_info:*' formats '(%s)-[%b]'
zstyle ':vcs_info:*' actionformats '(%s)-[%b|%a]'
zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:r%r'
zstyle ':vcs_info:bzr:*' use-simple true
function _update_vcs_info_msg() {
psvar=()
LANG=en_US.UTF-8 vcs_info
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_"
# http://stnard.jp/2010/10/25/402/
if [[ -e $PWD/.git/refs/stash ]]; then
stashes=$(git stash list 2>/dev/null | wc -l)
psvar[2]=" @${stashes// /}"
fi
}
add-zsh-hook precmd _update_vcs_info_msg
RPROMPT="%1(v|%F{green}%1v%f%F{yellow}%2v%f|)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment