From 59415920600d3493afd50c2e4728305dbacc997b Mon Sep 17 00:00:00 2001 From: Andreas Galauner Date: Thu, 27 Aug 2015 20:06:06 +0200 Subject: [PATCH] Add support for three display modes of the path in the prompt: short, medium and long --- README.md | 2 +- bullet-train.zsh-theme | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b397973..1b79404 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,7 @@ or don't want to see. All options must be overridden in your **.zshrc** file. |`BULLETTRAIN_DIR_BG`|`blue`|Background color |`BULLETTRAIN_DIR_FG`|`white`|Foreground color |`BULLETTRAIN_DIR_CONTEXT_SHOW`|`false`|Show user and machine in an SCP formatted style -|`BULLETTRAIN_DIR_EXTENDED`|`true`|Extended path +|`BULLETTRAIN_DIR_EXTENDED`|`1`|Extended path (0=short path, 1=medium path, 2=complete path, everything else=medium path) ### Git diff --git a/bullet-train.zsh-theme b/bullet-train.zsh-theme index 712c4e5..70a311c 100644 --- a/bullet-train.zsh-theme +++ b/bullet-train.zsh-theme @@ -107,7 +107,7 @@ if [ ! -n "${BULLETTRAIN_DIR_CONTEXT_SHOW+1}" ]; then BULLETTRAIN_DIR_CONTEXT_SHOW=false fi if [ ! -n "${BULLETTRAIN_DIR_EXTENDED+1}" ]; then - BULLETTRAIN_DIR_EXTENDED=true + BULLETTRAIN_DIR_EXTENDED=1 fi # GIT @@ -319,7 +319,18 @@ prompt_dir() { local dir='' local _context="$(context)" [[ $BULLETTRAIN_DIR_CONTEXT_SHOW == true && -n "$_context" ]] && dir="${dir}${_context}:" - [[ $BULLETTRAIN_DIR_EXTENDED == true ]] && dir="${dir}%4(c:...:)%3c" || dir="${dir}%1~" + + if [[ $BULLETTRAIN_DIR_EXTENDED == 0 ]]; then + #short directories + dir="${dir}%1~" + elif [[ $BULLETTRAIN_DIR_EXTENDED == 2 ]]; then + #long directories + dir="${dir}%0~" + else + #medium directories (default case) + dir="${dir}%4(c:...:)%3c" + fi + prompt_segment $BULLETTRAIN_DIR_BG $BULLETTRAIN_DIR_FG $dir }