Skip to content

Instantly share code, notes, and snippets.

@yureative
Last active August 29, 2015 13:56
Show Gist options
  • Save yureative/9148218 to your computer and use it in GitHub Desktop.
Save yureative/9148218 to your computer and use it in GitHub Desktop.
Show current git branch and repository name on zsh prompt.
setopt prompt_subst
autoload -Uz vcs_info
zstyle ':vcs_info:*' actionformats \
'%F{5}[%F{2}%b%F{7}:%F{6}%r%F{3}|%F{1}%a%F{5}]%f'
zstyle ':vcs_info:*' formats \
'%F{5}[%F{2}%b%F{7}:%F{6}%r%F{5}]%f'
zstyle ':vcs_info:*' enable git
vcs_info_wrapper() {
vcs_info
if [ -n "$vcs_info_msg_0_" ]; then
echo "%{$fg[grey]%}${vcs_info_msg_0_}%{$reset_color%}$del"
fi
}
RPROMPT=$'$(vcs_info_wrapper)'
@yureative
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment