Skip to content

Instantly share code, notes, and snippets.

@yrchen
Created April 3, 2011 11:57
Show Gist options
  • Save yrchen/900383 to your computer and use it in GitHub Desktop.
Save yrchen/900383 to your computer and use it in GitHub Desktop.
# Prompt which indicates VCS info in Zsh
autoload -Uz vcs_info
zstyle ':vcs_info:*' actionformats \
'%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
zstyle ':vcs_info:*' formats \
'%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f '
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' enable git cvs svn
# or use pre_cmd, see man zshcontrib
vcs_info_wrapper() {
vcs_info
if [ -n "$vcs_info_msg_0_" ]; then
echo "%{$fg[grey]%}${vcs_info_msg_0_}%{$reset_color%}$del"
fi
}
setopt prompt_subst
PROMPT="[$PR_MAGENTA%n$PR_NO_COLOR@$PR_GREEN%U%m%u$PR_NO_COLOR:$PR_RED%2c$PR_NO_COLOR]"'$(vcs_info_wrapper)'"%(!.#.$) "
RPROMPT="$PR_MAGENTA(%D{%m-%d %H:%M})$PR_NO_COLOR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment