20 lines
470 B
Text
20 lines
470 B
Text
CSTATUS=""
|
|
update_cstatus() {
|
|
git_stat=`cd /opt/tools/c/repo; git diff --shortstat | tr -c -d '[0-9,]'`
|
|
if [[ "$git_stat" = "" ]]; then
|
|
CSTATUS=""
|
|
else
|
|
stats=(${(@s:,:)git_stat})
|
|
CSTATUS="[%F{green}+${stats[2]}%f/%F{red}-${stats[3]}%f]"
|
|
fi
|
|
}
|
|
|
|
autoload -U add-zsh-hook
|
|
add-zsh-hook preexec update_cstatus
|
|
add-zsh-hook precmd update_cstatus
|
|
|
|
setopt PROMPT_SUBST
|
|
PS1='%T $CSTATUS %(?.%F{green}√.%F{red}?%?)%f %F{#666}%~%f %# '
|
|
|
|
alias c="/opt/tools/c/src/c.sh"
|
|
|