Created
August 19, 2011 16:53
-
-
Save cbarrett/1157321 to your computer and use it in GitHub Desktop.
zsh vcs_info example
This file contains 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
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