dotfiles

Personal dotfiles
git clone https://git.bracken.jp/dotfiles.git
Log | Files | Refs | LICENSE

commit 2313fd54c4e4f6e4523b746c41b2d27bc35572eb
parent a9377adf3f86cb8679fc867eabf0230997f4ae80
Author: Chris Bracken <chris@bracken.jp>
Date:   Tue, 26 May 2015 20:27:47 -0700

Move git branch from $RPROMPT to $PROMPT.

Diffstat:
M.zshrc | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/.zshrc b/.zshrc @@ -21,7 +21,10 @@ zstyle ':completion:*' menu select # current git branch (for prompt) git_branch() { - echo $(git rev-parse --abbrev-ref HEAD 2> /dev/null) + local branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null) + if [[ -n $branch ]]; then + echo " ($branch)" + fi } # prompt @@ -42,11 +45,9 @@ if [ -n "$force_color_prompt" ]; then fi if [ "$color_prompt" = yes ]; then - PROMPT="%{$fg[yellow]%}%T %{$fg[green]%}%n@%m%{$reset_color%}:%{$fg_bold[blue]%}%c%{$reset_color%}%# " - RPROMPT=$'%{$fg[yellow]%}$(git_branch)%{$reset_color%}' + PROMPT='%{$fg[yellow]%}%T %{$fg[green]%}%n@%m%{$reset_color%}:%{$fg_bold[blue]%}%c%{$fg[yellow]%}$(git_branch)%{$reset_color%}%# ' else - PROMPT="%T %n@%m:%c%# " - RPROMPT=$'$(git_branch)' + PROMPT="%T %n@%m:%c$(git_branch)%# " fi unset color_prompt force_color_prompt