From d3f499758276d590334727ec8dce649896191439 Mon Sep 17 00:00:00 2001 From: Dawid Kurek Date: Tue, 26 Jan 2016 21:11:12 +0100 Subject: [PATCH] Allow settings custom git prompt This gives us ability to use string substitution for changing e.g. how branch name is displayed. --- bullet-train.zsh-theme | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bullet-train.zsh-theme b/bullet-train.zsh-theme index 48a3f22..376e29d 100644 --- a/bullet-train.zsh-theme +++ b/bullet-train.zsh-theme @@ -160,6 +160,9 @@ fi if [ ! -n "${BULLETTRAIN_GIT_EXTENDED+1}" ]; then BULLETTRAIN_GIT_EXTENDED=true fi +if [ ! -n "${BULLETTRAIN_GIT_PROMPT_CMD+1}" ]; then + BULLETTRAIN_GIT_PROMPT_CMD="\$(git_prompt_info)" +fi # HG if [ ! -n "${BULLETTRAIN_HG_SHOW+1}" ]; then @@ -343,7 +346,7 @@ prompt_git() { return fi - local ref dirty mode repo_path + local ref dirty mode repo_path git_prompt repo_path=$(git rev-parse --git-dir 2>/dev/null) if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then @@ -352,10 +355,11 @@ prompt_git() { fi prompt_segment $BULLETTRAIN_GIT_BG $BULLETTRAIN_GIT_FG + eval git_prompt=${BULLETTRAIN_GIT_PROMPT_CMD} if [[ $BULLETTRAIN_GIT_EXTENDED == true ]]; then - echo -n $(git_prompt_info)$(git_prompt_status) + echo -n ${git_prompt}$(git_prompt_status) else - echo -n $(git_prompt_info) + echo -n ${git_prompt} fi fi }