summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorRoman Perepelitsa <roman.perepelitsa@gmail.com>2020-09-29 14:40:06 +0300
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2020-09-29 14:40:06 +0300
commit42aa719e48ab23ce009bb978a300eef1c85cf552 (patch)
tree4cf043ce972e4b7c0e3a3f9522a41e451067b376 /internal
parent3586cc8d7e0ec66015052dadf36414615e950e18 (diff)
dir: ignore separator overrides if cwd is / and POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER is true
Diffstat (limited to 'internal')
-rw-r--r--internal/p10k.zsh28
1 files changed, 16 insertions, 12 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 7911ad2f..e322a95a 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -1997,19 +1997,23 @@ prompt_dir() {
parts=("${(@)parts//$'\3'}")
fi
- local sep=''
- if (( $+parameters[_POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND] ||
- $+parameters[_POWERLEVEL9K_${(U)state}_PATH_SEPARATOR_FOREGROUND] )); then
- _p9k_color $state PATH_SEPARATOR_FOREGROUND ''
- _p9k_foreground $_p9k__ret
- (( expand )) && _p9k_escape_style $_p9k__ret
- sep=$_p9k__ret
+ if [[ $_p9k__cwd == / && $_POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER == 1 ]]; then
+ local sep='/'
+ else
+ local sep=''
+ if (( $+parameters[_POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND] ||
+ $+parameters[_POWERLEVEL9K_${(U)state}_PATH_SEPARATOR_FOREGROUND] )); then
+ _p9k_color $state PATH_SEPARATOR_FOREGROUND ''
+ _p9k_foreground $_p9k__ret
+ (( expand )) && _p9k_escape_style $_p9k__ret
+ sep=$_p9k__ret
+ fi
+ _p9k_param $state PATH_SEPARATOR /
+ _p9k__ret=${(g::)_p9k__ret}
+ (( expand )) && _p9k_escape $_p9k__ret
+ sep+=$_p9k__ret
+ [[ $sep == *%* ]] && sep+=$style
fi
- _p9k_param $state PATH_SEPARATOR /
- _p9k__ret=${(g::)_p9k__ret}
- (( expand )) && _p9k_escape $_p9k__ret
- sep+=$_p9k__ret
- [[ $sep == *%* ]] && sep+=$style
local content="${(pj.$sep.)parts}"
if (( _POWERLEVEL9K_DIR_HYPERLINK && _p9k_term_has_href )) && [[ $_p9k__cwd == /* ]]; then