From c58777067d984965dea8bfdf84bac2fd7075802a Mon Sep 17 00:00:00 2001 From: Thomas Kolb Date: Sat, 3 Jan 2015 17:05:47 +0100 Subject: [PATCH] New zsh prompt for user config --- zsh/zshrc.user | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/zsh/zshrc.user b/zsh/zshrc.user index b5dc3b1..a1e0633 100644 --- a/zsh/zshrc.user +++ b/zsh/zshrc.user @@ -1,13 +1,18 @@ # extract the current branch from git repositories parse_git_branch() { - git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' + BRANCH=$(git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') + + if [ ! -z "$BRANCH" ]; then + echo " $BRANCH " + fi } # enable command substitution in prompts setopt prompt_subst # Set prompt -PS1=$'%(?..%{\e[01;31m%}%? )%{\e[01;32m%}%n@%m%{\e[01;34m%} %~%{\e[01;33m%}$(parse_git_branch) %{\e[00m%}%(!.#.$) ' +#PS1=$'%{\e[01;32m%}%n@%m%{\e[01;34m%} %~%{\e[01;33m%}$(parse_git_branch) %{\ek\e\\%}%{\e[00m%}%(!.#.$) ' +PS1=$'%{\e[30m%}%(?.%{\e[42m%} ✔ .%{\e[41m%} ✘ [%?] )%{\e[42m%} %n@%m %{\e[43m%}$(parse_git_branch)%{\e[1;37m%}%{\e[44m%} %~ %{\e[49m\e[0;34m%}▶%{\e[0m%} ' # aliases alias q3defrag="/opt/quake3/ioquake3 +set fs_game defrag"