c.sh/zsh.config

21 lines
470 B
Plaintext
Raw Normal View History

2021-12-06 15:01:12 +01:00
CSTATUS=""
update_cstatus() {
2021-12-07 22:23:07 +01:00
git_stat=`cd /opt/tools/c/repo; git diff --shortstat | tr -c -d '[0-9,]'`
2021-12-06 15:01:12 +01:00
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 %# '
2021-12-07 22:26:42 +01:00
alias c="/opt/tools/c/src/c.sh"
2021-12-06 15:01:12 +01:00