mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-19 22:11:57 +00:00
add caching to prompt_dir
This commit is contained in:
parent
97dbb6ab16
commit
eff8d47b42
1 changed files with 44 additions and 39 deletions
|
@ -856,8 +856,11 @@ prompt_dir() {
|
|||
;;
|
||||
esac
|
||||
|
||||
[[ $POWERLEVEL9K_DIR_SHOW_WRITABLE == true && ! -w $PWD ]]
|
||||
local w=$?
|
||||
if ! _p9k_cache_get $0 $w $fake_first "$delim" "${parts[@]}"; then
|
||||
local state='' icon=''
|
||||
if [[ $POWERLEVEL9K_DIR_SHOW_WRITABLE == true && ! -w $PWD ]]; then
|
||||
if (( ! w )); then
|
||||
state=NOT_WRITABLE
|
||||
icon=LOCK_ICON
|
||||
else
|
||||
|
@ -898,7 +901,9 @@ prompt_dir() {
|
|||
sep=$_P9K_RETVAL$sep
|
||||
fi
|
||||
|
||||
"$1_prompt_segment" "$0_$state" "$2" blue "$DEFAULT_COLOR" "$icon" 0 "" "${(pj.$sep.)parts}"
|
||||
_p9k_cache_set "$0_$state" "$2" blue "$DEFAULT_COLOR" "$icon" 0 "" "${(pj.$sep.)parts}"
|
||||
fi
|
||||
"$1_prompt_segment" "$_P9K_CACHE_VAL[@]"
|
||||
}
|
||||
|
||||
################################################################
|
||||
|
|
Loading…
Reference in a new issue