Last active
August 29, 2015 13:56
-
-
Save yureative/9148218 to your computer and use it in GitHub Desktop.
Show current git branch and repository name on zsh prompt.
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
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)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I referred to this site page.
http://stackoverflow.com/questions/1128496/to-get-a-prompt-which-indicates-git-branch-in-zsh