From 453b811eb4748fdd35ce4c486adcf25108b19bd3 Mon Sep 17 00:00:00 2001 From: Wiktor Zykubek Date: Fri, 13 Mar 2020 17:52:41 +0100 Subject: [PATCH] Add info about git branch to .zshrc --- botfiles/.zshrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/botfiles/.zshrc b/botfiles/.zshrc index 7b21e26..de1b1f2 100644 --- a/botfiles/.zshrc +++ b/botfiles/.zshrc @@ -19,9 +19,19 @@ source "${HOME}/.aliases" source "${HOME}/.zprofile" # Prompt +source ~/.config/zsh/plugins/zsh-git-prompt/zshrc.sh #export PROMPT="%B%F{blue}%~ %b%f$ " export PROMPT=' %F{#299b9b}%~ %f [%B%F{red}%?%f%b]%F{#299b9b}%B>%b%f ' +export RPROMPT='$(git_status)' + +function git_status() { + ref=$(git symbolic-ref --quiet --short HEAD 2> /dev/null || git rev-parse --short HEAD 2> /dev/null) + if [ $? -eq 0 ]; then + echo -n "on %B%F{magenta}$ref" + [[ $(git status --short | wc -l) -ne 0 ]] && echo -n "%F{yellow}*" + fi +} # Completetion autoload -U compinit