Show only basename and git branch in prompt

* Switch order from "[git branch][pathname]" to "basename git branch %".
* Remove noisy brackets.

Example old:

    [master][~/dev/thoughtbot/dotfiles]

Example new:

    dotfiles dc-prompt %
This commit is contained in:
Dan Croak 2014-03-26 22:30:07 -07:00
parent 397155648d
commit 7dbc8f44a1

4
zshrc
View file

@ -2,11 +2,11 @@
git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null)
if [[ -n $ref ]]; then
echo "[%{$fg_bold[green]%}${ref#refs/heads/}%{$reset_color%}]"
echo " %{$fg_bold[green]%}${ref#refs/heads/}%{$reset_color%}"
fi
}
setopt promptsubst
export PS1='$(git_prompt_info)[${SSH_CONNECTION+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[blue]%}%~%{$reset_color%}] '
export PS1='${SSH_CONNECTION+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[blue]%}%c%{$reset_color%}$(git_prompt_info) %# '
# load our own completion functions
fpath=(~/.zsh/completion $fpath)