Skip to content

Instantly share code, notes, and snippets.

@cbarrett
Created August 19, 2011 16:53
Show Gist options
  • Save cbarrett/1157321 to your computer and use it in GitHub Desktop.
Save cbarrett/1157321 to your computer and use it in GitHub Desktop.
zsh vcs_info example
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable hg
zstyle ':vcs_info:hg*' formats "%F{green}%b%f"
zstyle ':vcs_info:hg*' actionformats "%F{red}%a%f %F{green}%b%f"
zstyle ':vcs_info:hg*+set-message:*' hooks no-default-branch
function +vi-no-default-branch() {
[[ "${hook_com[branch_orig]}" != "default" ]] && return 0
ret=1
if [[ "${hook_com[action_orig]}" == "" ]]; then
hook_com[message]=""
else
hook_com[message]="%F{red}${hook_com[action]}%f"
fi
}
function precmd() {
vcs_info
}
PS1=$'%(?..%F{red}%?%f\n)${vcs_info_msg_0_}%# '
RPS1='%~'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment