add caching to prompt_dir

pull/78/head
romkatv 6 years ago
parent 97dbb6ab16
commit eff8d47b42

@ -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…
Cancel
Save