summaryrefslogtreecommitdiff
path: root/zsh
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2021-06-26 14:58:26 +0100
committerGrégoire Duchêne <gduchene@awhk.org>2021-06-26 14:58:26 +0100
commitd56519f98e29eb8a19b5686bb795f89139bac7c0 (patch)
tree62eb57b462aa1b999af985b39dab4629a342cb99 /zsh
parent26831afb5ae86c042d859d1b5c9e039dfe12a093 (diff)
zsh: Show current Git branch in ${RPROMPT}
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.
Diffstat (limited to 'zsh')
-rw-r--r--zsh/rc12
1 files changed, 12 insertions, 0 deletions
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