|
|
@ -1138,16 +1138,25 @@ prompt_dir() {
|
|
|
|
truncate_to_unique)
|
|
|
|
truncate_to_unique)
|
|
|
|
expand=1
|
|
|
|
expand=1
|
|
|
|
delim=${POWERLEVEL9K_SHORTEN_DELIMITER-'*'}
|
|
|
|
delim=${POWERLEVEL9K_SHORTEN_DELIMITER-'*'}
|
|
|
|
_p9k_prompt_length $delim
|
|
|
|
local -i i=2
|
|
|
|
local -i real_delim_len=_P9K_RETVAL i=2 n=1 q=0
|
|
|
|
|
|
|
|
[[ $p[1] == / ]] && (( ++i ))
|
|
|
|
[[ $p[1] == / ]] && (( ++i ))
|
|
|
|
|
|
|
|
local parent="${PWD%/${(pj./.)parts[i,-1]}}"
|
|
|
|
|
|
|
|
if (( i <= $#parts )); then
|
|
|
|
|
|
|
|
local mtime=()
|
|
|
|
|
|
|
|
zstat -A mtime +mtime -- ${(@)${:-{$i..$#parts}}/(#b)(*)/$parent/${(pj./.)parts[i,$match[1]]}} 2>/dev/null || mtime=()
|
|
|
|
|
|
|
|
mtime="${(pj:\1:)mtime}"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
local mtime='good'
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! _p9k_cache_get $0 "${parts[@]}" || [[ -z $mtime || $mtime != $_P9K_CACHE_VAL[1] ]] ; then
|
|
|
|
|
|
|
|
_p9k_prompt_length $delim
|
|
|
|
|
|
|
|
local -i real_delim_len=_P9K_RETVAL n=1 q=0
|
|
|
|
[[ -n $parts[i-1] ]] && parts[i-1]="\${(Q)\${:-${(qqq)${(q)parts[i-1]}}}}"$'\2'
|
|
|
|
[[ -n $parts[i-1] ]] && parts[i-1]="\${(Q)\${:-${(qqq)${(q)parts[i-1]}}}}"$'\2'
|
|
|
|
[[ $p[i,-1] == *["~!#\$^&*()\\\"'<>?{}[]"]* ]] && q=1
|
|
|
|
[[ $p[i,-1] == *["~!#\$^&*()\\\"'<>?{}[]"]* ]] && q=1
|
|
|
|
local -i d=${POWERLEVEL9K_SHORTEN_DELIMITER_LENGTH:--1}
|
|
|
|
local -i d=${POWERLEVEL9K_SHORTEN_DELIMITER_LENGTH:--1}
|
|
|
|
(( d >= 0 )) || d=real_delim_len
|
|
|
|
(( d >= 0 )) || d=real_delim_len
|
|
|
|
shortenlen=${POWERLEVEL9K_SHORTEN_DIR_LENGTH:-1}
|
|
|
|
shortenlen=${POWERLEVEL9K_SHORTEN_DIR_LENGTH:-1}
|
|
|
|
(( shortenlen >= 0 )) && n=shortenlen
|
|
|
|
(( shortenlen >= 0 )) && n=shortenlen
|
|
|
|
local parent="${PWD%/${(pj./.)parts[i,-1]}}"
|
|
|
|
|
|
|
|
for (( ; i <= $#parts - n; ++i )); do
|
|
|
|
for (( ; i <= $#parts - n; ++i )); do
|
|
|
|
local dir=$parts[i]
|
|
|
|
local dir=$parts[i]
|
|
|
|
if [[ -n $POWERLEVEL9K_SHORTEN_FOLDER_MARKER &&
|
|
|
|
if [[ -n $POWERLEVEL9K_SHORTEN_FOLDER_MARKER &&
|
|
|
@ -1179,6 +1188,9 @@ prompt_dir() {
|
|
|
|
(( q )) && parts[i]='${(Q)${:-'${(qqq)${(q)parts[i]}}'}}'
|
|
|
|
(( q )) && parts[i]='${(Q)${:-'${(qqq)${(q)parts[i]}}'}}'
|
|
|
|
parts[i]+=$'\2'
|
|
|
|
parts[i]+=$'\2'
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
_p9k_cache_set "$mtime" "${parts[@]}"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
parts=("${(@)_P9K_CACHE_VAL[2,-1]}")
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
truncate_with_folder_marker)
|
|
|
|
truncate_with_folder_marker)
|
|
|
|
if [[ -n $POWERLEVEL9K_SHORTEN_FOLDER_MARKER ]]; then
|
|
|
|
if [[ -n $POWERLEVEL9K_SHORTEN_FOLDER_MARKER ]]; then
|
|
|
|