From 2cfbb23f0040e9aa9819d357b38fdff9782732dd Mon Sep 17 00:00:00 2001 From: Max Bucknell Date: Wed, 15 Mar 2017 14:41:39 +0400 Subject: [PATCH] Use better git prompt --- zsh/zshrc.symlink | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/zsh/zshrc.symlink b/zsh/zshrc.symlink index 5652113..979b3e6 100644 --- a/zsh/zshrc.symlink +++ b/zsh/zshrc.symlink @@ -1,3 +1,5 @@ +source /etc/bash_completion.d/git-prompt + ## Path # Default path export PATH="/sbin" @@ -91,10 +93,16 @@ COLOR="$fg[$COLOR_NAME]" # # If we are not on a branch, print the short ref. function git-prompt-info { - REF=$(command git current-branch 2> /dev/null) || \ - REF=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 + local ref=$(__git_ps1 | sed 's/(//g' | sed 's/)//g' | sed 's/^ //') + + if [ -z "$ref" ] + then + echo "" + return 0 + fi + COLOR="$fg[$FEATURE_COLORS[$(nice-hostname)]]" - echo "($COLOR$REF$reset_color)" + echo "($COLOR$ref$reset_color)" } # Keep track of editing mode.