From ef4f26044b7ca342b02ca505b01210953200b987 Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Tue, 20 Sep 2022 15:56:13 +0200 Subject: [PATCH] shorten branch names and better agenda --- zshrc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/zshrc b/zshrc index 2d554f7..a74e379 100644 --- a/zshrc +++ b/zshrc @@ -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 <<