From 4ca7dac5704a5b7e22ddb4952c38c09fbbcaa0bd Mon Sep 17 00:00:00 2001 From: Alexis Hovorka Date: Tue, 27 Oct 2020 11:09:28 -0600 Subject: [feat] Add git branch to zsh `k` listing --- base/zsh/k.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'base') diff --git a/base/zsh/k.zsh b/base/zsh/k.zsh index 6e2e2bd..e61cbdf 100644 --- a/base/zsh/k.zsh +++ b/base/zsh/k.zsh @@ -209,6 +209,7 @@ k () { # only set once per directory so must be out of the main loop typeset -i IS_GIT_REPO=0 typeset GIT_TOPLEVEL + typeset GIT_TOPBRANCH #typeset -i LARGE_FILE_COLOR=196 typeset -i LARGE_FILE_COLOR=1 @@ -274,6 +275,7 @@ k () { if $(git rev-parse --is-inside-work-tree 2> /dev/null); then INSIDE_WORK_TREE=1 GIT_TOPLEVEL=$(git rev-parse --show-toplevel) + GIT_TOPBRANCH="[$(git rev-parse --abbrev-ref HEAD 2>/dev/null)]" fi # Break total blocks of the front of the stat call, then push the rest to results @@ -350,7 +352,7 @@ k () { done # Print total block before listing - echo "total $TOTAL_BLOCKS" + echo "total $TOTAL_BLOCKS "$'\e['"$K_COLOR_BR"'m'"$GIT_TOPBRANCH"$'\e[0m' # ---------------------------------------------------------------------------- # Loop through each line of stat, pad where appropriate and do git dirty checking -- cgit v1.2.3-70-g09d2