zsh - add git branch in prompt

master
Julien Rosset 6 years ago
parent 065dae10d4
commit b39af97649

@ -57,8 +57,26 @@ done
# USER part
# Interface de demande
setopt prompt_subst
autoload -Uz vcs_info
zstyle ':vcs_info:*' actionformats \
'[%b%]%f '
zstyle ':vcs_info:*' formats \
'[%b]%f '
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' enable git
# or use pre_cmd, see man zshcontrib
vcs_info_wrapper() {
vcs_info
if [ -n "$vcs_info_msg_0_" ]; then
echo "%{$fg[blue]%}${vcs_info_msg_0_}%{$reset_color%}"
fi
}
autoload -U colors && colors
PROMPT="%{${fg_bold[red]}%}%n%{${fg[blue]}%}@%{${fg[green]}%}%m %{${fg[magenta]}%}%~ %{${fg_bold[yellow]}%}%#%{${reset_color}%} "
PROMPT=$'%{${fg_bold[red]}%}%n%{${fg[blue]}%}@%{${fg[green]}%}%m %{${fg[magenta]}%}%~ $(vcs_info_wrapper)%{${fg_bold[yellow]}%}%#%{${reset_color}%} '
# Variables
export MOZILLA_FIVE_HOME=/usr/lib/mozilla

Loading…
Cancel
Save