From d56519f98e29eb8a19b5686bb795f89139bac7c0 Mon Sep 17 00:00:00 2001 From: Grégoire Duchêne Date: Sat, 26 Jun 2021 14:58:26 +0100 Subject: zsh: Show current Git branch in ${RPROMPT} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This does not apply if ${TERM_PROGRAM} is ‘iTerm.app’ as iTerm2 already has a status bar that shows that information. See https://iterm2.com/documentation-status-bar.html for more details. --- zsh/rc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'zsh/rc') diff --git a/zsh/rc b/zsh/rc index 3170617..1b56d48 100644 --- a/zsh/rc +++ b/zsh/rc @@ -60,6 +60,18 @@ setopt HIST_REDUCE_BLANKS setopt INC_APPEND_HISTORY setopt SHARE_HISTORY +if [[ ${TERM_PROGRAM} != iTerm.app ]]; then + autoload -Uz vcs_info + + zstyle ':vcs_info:*' enable git + zstyle ':vcs_info:*' formats '[%b]' + + RPROMPT='${vcs_info_msg_0_}' + precmd_functions+=(vcs_info) + + setopt PROMPT_SUBST +fi + source_if_exists dotfiles-${UNAME}/zsh/rc source_if_exists dotfiles-${DOMAIN}/zsh/rc source_if_exists dotfiles-${HOST}/zsh/rc -- cgit v1.2.3-70-g09d2