diff options
author | Alexis Hovorka <[email protected]> | 2020-10-27 11:09:28 -0600 |
---|---|---|
committer | Alexis Hovorka <[email protected]> | 2020-10-27 11:09:28 -0600 |
commit | 4ca7dac5704a5b7e22ddb4952c38c09fbbcaa0bd (patch) | |
tree | 1ed5c33dd6a75facf4b97346e92c478a4e4ae063 | |
parent | d9a657da5e86c2e47b218ccbad0ba19c9cde28c9 (diff) |
[feat] Add git branch to zsh `k` listing
-rw-r--r-- | base/zsh/k.zsh | 4 |
1 files changed, 3 insertions, 1 deletions
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 |