From cbed169ca94e8ab0ecc8db814d41824011e007cc Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Wed, 10 Oct 2012 13:53:51 -0700 Subject: [PATCH] Export gitbranch variable after getting branch name from git --- zshrc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/zshrc b/zshrc index a58d3c8..deb75b3 100644 --- a/zshrc +++ b/zshrc @@ -43,7 +43,6 @@ precmd_prompt() else isroot="%(!.%{$fg_bold[red]%}%#%{$reset_color%}.%#)" fi - PROMPT_LINE="$isroot " } @@ -56,14 +55,13 @@ precmd_info() precmd_git_branch() { - git_branch_output=`git branch 2>/dev/null` + local git_branch_output=`git branch 2>/dev/null` if [[ $? -eq 0 ]]; then - local branch=`echo $git_branch_output | grep '^\*' | cut -d' ' -f2` - PROMPT_REPO="%B%F{cyan}$branch%f%b" + export gitbranch=`echo $git_branch_output | grep '^\*' | cut -d' ' -f2` + PROMPT_REPO="%B%F{cyan}$gitbranch%f%b" else PROMPT_REPO='' fi - unset git_branch_output } precmd_flags_rprompt()