From 8e4d61fb77ed68f896b6fe3dc0bbbcd078668ede Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Tue, 13 Aug 2019 23:33:32 -0400 Subject: zsh: adopt --- templates/.zsh/functions/git-branches.zsh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 templates/.zsh/functions/git-branches.zsh (limited to 'templates/.zsh/functions/git-branches.zsh') diff --git a/templates/.zsh/functions/git-branches.zsh b/templates/.zsh/functions/git-branches.zsh new file mode 100644 index 0000000..4636cab --- /dev/null +++ b/templates/.zsh/functions/git-branches.zsh @@ -0,0 +1,23 @@ +green=`tput setaf 2` +reset=`tput sgr0` + +git-branches() { + set -f + git branch | while read line; do + current=" " + name=${line##\* } ## removes leading * for current + + if [ ! "$name" = "$line" ]; then + current="${green}* " + fi + + description=`git config "branch.$name.description"` + + if [ "$description" != "" ]; then + description=" : $description" + fi + + echo "${reset}${current}${name}${description}${reset}" + done + set +f +} -- cgit v1.2.3