Skip to content

Instantly share code, notes, and snippets.

@nysalor
Created April 22, 2012 07:21
Show Gist options
  • Save nysalor/2462510 to your computer and use it in GitHub Desktop.
Save nysalor/2462510 to your computer and use it in GitHub Desktop.
display repository status on right prompt
# right prompt
autoload -Uz add-zsh-hook
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn hg bzr
zstyle ':vcs_info:*' formats '[%b]'
zstyle ':vcs_info:*' actionformats '[%b|%a]'
zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:r%r'
zstyle ':vcs_info:bzr:*' use-simple true
autoload -Uz is-at-least
if is-at-least 4.3.10; then
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' stagedstr "+"
zstyle ':vcs_info:git:*' unstagedstr "-"
zstyle ':vcs_info:git:*' formats '[%b[%c%u]]'
zstyle ':vcs_info:git:*' actionformats '[%b|%a[%c%u]]'
fi
function _update_vcs_info_msg() {
psvar=()
LANG=en_US.UTF-8 vcs_info
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_"
}
add-zsh-hook precmd _update_vcs_info_msg
RPROMPT="%1(v|%F{green}%1v%f|) [%20<..<%~]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment