aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-07-01 20:09:10 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-07-01 20:09:10 +0300
commit9b818960c22979ea67a4060101bf6aaa354d4f65 (patch)
tree469c0de6687a1dffcd8169b34b18e6a5c354b449
parent613ffec4b61fc8c97427a99bcca72808a980645e (diff)
parent6f14212c14bb808e3a1b4c721f7c6cc8be0938d0 (diff)
Merge branch 'raul-benito-master'
-rwxr-xr-xinternal/p10k.zsh19
1 files changed, 12 insertions, 7 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index fd3f3778..45021cef 100755
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -42,6 +42,16 @@ typeset -gi _P9K_I
typeset -g _P9K_BG
typeset -g _P9K_F
+typeset -gA ICON_ASSOC=(
+ "/etc|/etc/*" ETC_ICON
+ "${HOME}" HOME_ICON
+ "${HOME}/*" HOME_SUB_ICON
+ )
+typeset -gA STATE_ASSOC=(
+ "/etc|/etc/*" ETC
+ "${HOME}" HOME
+ "${HOME}/*" HOME_SUBFOLDER
+ )
# Specifies the maximum number of elements in the cache. When the cache grows over this limit,
# it gets cleared. This is meant to avoid memory leaks when a rogue prompt is filling the cache
# with data.
@@ -868,14 +878,9 @@ prompt_dir() {
state=NOT_WRITABLE
icon=LOCK_ICON
else
- case $PWD in
- /etc|/etc/*) state=ETC; icon=ETC_ICON;;
- ~) state=HOME; icon=HOME_ICON;;
- ~/*) state=HOME_SUBFOLDER; icon=HOME_SUB_ICON;;
- *) state=DEFAULT; icon=FOLDER_ICON;;
- esac
+ icon=${ICON_ASSOC[(k)$PWD]:-DEFAULT}
+ state=${STATE_ASSOC[(k)$PWD]:-DEFAULT}
fi
-
local style=%b
_p9k_color blue $0_$state BACKGROUND
_p9k_background $_P9K_RETVAL