shorten branch names and better agenda

This commit is contained in:
Felix Van der Jeugt 2022-09-20 15:56:13 +02:00
parent 7a102b7299
commit ef4f26044b

9
zshrc
View File

@ -24,6 +24,9 @@ prompt_git() {
porcelain="$(git status --branch --porcelain 2>/dev/null)"
if test "$?" = 0; then
branch="$(printf '%s' "$porcelain" | sed -n 's/\.\.\..*//;1s/## //p')"
if [ ${#branch} -gt 30 ]; then
branch="$(printf '%.27s...' "$branch")"
fi
behind="$(printf '%s' "$porcelain" | sed -n '1s/## .*behind \([0-9]*\).*/-\1/p')"
ahead="$(printf '%s' "$porcelain" | sed -n '1s/## .*ahead \([0-9]*\).*/+\1/p')"
gstatus="$({ echo OK; printf '%s' "$porcelain" | sed '/##/d;s/\(..\).*/\1/'; } | tail -1)"
@ -75,10 +78,12 @@ alias agent='eval "$(ssh-agent)" && ssh-add'
alias unlock='gpg-connect-agent <<<bye'
alias weechat="ssh -t weechat@Hetzner abduco -A weechat"
alias agenda="khal list today 7d --format '{calendar-color}{cancelled}{start-end-time-style}{repeat-symbol} {title}{reset}'"
alias plan="khal list --notstarted now eod"
alias ncspot="abduco -A ncspot ncspot"
function agenda() {
khal calendar --format '{calendar-color}{cancelled}{start-end-time-style}{repeat-symbol} {title}{reset}' ${@:-today 2d}
}
# Ledger
alias haccounts="hledger -I --alias '/.*:Accounts [^:]*:(.*)/=Accounts:\1' bal accounts"
alias is='hledger is -b $(date -d "7 months ago" +%Y-%m) -e $(date +%Y-%m) -MTA --tree -2'