Created
September 27, 2018 09:45
-
-
Save hadnazzar/b494abdfa1e5465786f771651f3a4430 to your computer and use it in GitHub Desktop.
Zsh Right Prompt for show github differences (diff --shortstat) in terminal 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
git_prompt() { | |
#temp=`git symbolic-ref HEAD 2>/dev/null | cut -d / -f 3` | |
temp=`git diff --shortstat | sed -e 's/insertions//' -e's/deletions//'` | |
if [ "$temp" != "" ]; then | |
RPROMPT='%{$fg_no_bold[green]%}git:($temp%)%{$reset_color%} %{$fg_no_bold[yellow]%}[%1~]%{$reset_color%} %t' | |
else | |
RPROMPT='%{$fg_no_bold[yellow]%}[%~]%{$reset_color%} %t' | |
fi | |
} | |
autoload -Uz add-zsh-hook | |
add-zsh-hook precmd git_prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment