c.sh/zsh.config

22 lines
528 B
Plaintext
Raw Permalink 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
2022-12-20 22:48:11 +01:00
PS1='($HOST) %T $CSTATUS %(?.%F{green}√.%F{red}?%?)%f %F{#666}%~%f %# '
2021-12-06 15:01:12 +01:00
2021-12-07 22:26:42 +01:00
alias c="/opt/tools/c/src/c.sh"
2021-12-06 15:01:12 +01:00
2022-12-20 22:47:13 +01:00
[[ -f ~/zsh-helpers.zsh ]] && . ~/zsh-helpers.zsh