|
|
@ -1560,7 +1560,12 @@ prompt_dir() {
|
|
|
|
shortenlen=${_POWERLEVEL9K_SHORTEN_DIR_LENGTH:-1}
|
|
|
|
shortenlen=${_POWERLEVEL9K_SHORTEN_DIR_LENGTH:-1}
|
|
|
|
(( shortenlen >= 0 )) || shortenlen=1
|
|
|
|
(( shortenlen >= 0 )) || shortenlen=1
|
|
|
|
local -i i=2 e=$(($#parts - shortenlen))
|
|
|
|
local -i i=2 e=$(($#parts - shortenlen))
|
|
|
|
[[ $p[1] == / ]] && (( ++i ))
|
|
|
|
if (( _POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER )); then
|
|
|
|
|
|
|
|
(( e += shortenlen ))
|
|
|
|
|
|
|
|
local orig=("$parts[2]" "${(@)parts[$((shortenlen > $#parts ? -$#parts : -shortenlen)),-1]}")
|
|
|
|
|
|
|
|
elif [[ $p[1] == / ]]; then
|
|
|
|
|
|
|
|
(( ++i ))
|
|
|
|
|
|
|
|
fi
|
|
|
|
local parent="${_p9k__pwd%/${(pj./.)parts[i,-1]}}"
|
|
|
|
local parent="${_p9k__pwd%/${(pj./.)parts[i,-1]}}"
|
|
|
|
if (( i <= e )); then
|
|
|
|
if (( i <= e )); then
|
|
|
|
local MATCH= mtimes=()
|
|
|
|
local MATCH= mtimes=()
|
|
|
@ -1611,11 +1616,34 @@ prompt_dir() {
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
parent+=/$sub
|
|
|
|
parent+=/$sub
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
if (( _POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER )); then
|
|
|
|
|
|
|
|
local _2=$'\2'
|
|
|
|
|
|
|
|
(( e = ${parts[(I)*$_2]} ))
|
|
|
|
|
|
|
|
if (( e > 1 )); then
|
|
|
|
|
|
|
|
parts[1,e-1]=()
|
|
|
|
|
|
|
|
fake_first=1
|
|
|
|
|
|
|
|
elif [[ $p == /?* ]]; then
|
|
|
|
|
|
|
|
parts[2]="\${(Q)\${:-${(qqq)${(q)orig[1]}}}}"$'\2'
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
for ((i = $#parts < shortenlen ? $#parts : shortenlen; i > 0; --i)); do
|
|
|
|
|
|
|
|
[[ $#parts[-i] == *$'\2' ]] && continue
|
|
|
|
|
|
|
|
if [[ $orig[-i] == *["~!#\`\$^&*()\\\"'<>?{}[]"]* ]]; then
|
|
|
|
|
|
|
|
parts[-i]='${(Q)${:-'${(qqq)${(q)orig[-i]}}'}}'$'\2'
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
parts[-i]=${orig[-i]}$'\2'
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
else
|
|
|
|
for ((; i <= $#parts; ++i)); do
|
|
|
|
for ((; i <= $#parts; ++i)); do
|
|
|
|
[[ $parts[i] == *["~!#\`\$^&*()\\\"'<>?{}[]"]* ]] && parts[i]='${(Q)${:-'${(qqq)${(q)parts[i]}}'}}'
|
|
|
|
[[ $parts[i] == *["~!#\`\$^&*()\\\"'<>?{}[]"]* ]] && parts[i]='${(Q)${:-'${(qqq)${(q)parts[i]}}'}}'
|
|
|
|
parts[i]+=$'\2'
|
|
|
|
parts[i]+=$'\2'
|
|
|
|
done
|
|
|
|
done
|
|
|
|
[[ -n $key ]] && _p9k_cache_ephemeral_set "$key" "${parts[@]}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n $key ]]; then
|
|
|
|
|
|
|
|
_p9k_cache_ephemeral_set "$key" "${parts[@]}"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
_p9k_cache_val=("$key" "${parts[@]}")
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
parts=("${(@)_p9k_cache_val[2,-1]}")
|
|
|
|
parts=("${(@)_p9k_cache_val[2,-1]}")
|
|
|
|
;;
|
|
|
|
;;
|
|
|
@ -5204,6 +5232,8 @@ _p9k_init_params() {
|
|
|
|
_p9k_declare -a POWERLEVEL9K_DIR_CLASSES
|
|
|
|
_p9k_declare -a POWERLEVEL9K_DIR_CLASSES
|
|
|
|
_p9k_declare -i POWERLEVEL9K_SHORTEN_DELIMITER_LENGTH
|
|
|
|
_p9k_declare -i POWERLEVEL9K_SHORTEN_DELIMITER_LENGTH
|
|
|
|
_p9k_declare -e POWERLEVEL9K_SHORTEN_DELIMITER
|
|
|
|
_p9k_declare -e POWERLEVEL9K_SHORTEN_DELIMITER
|
|
|
|
|
|
|
|
_p9k_declare -b POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER
|
|
|
|
|
|
|
|
[[ -z $_POWERLEVEL9K_SHORTEN_FOLDER_MARKER ]] && _POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=0
|
|
|
|
_p9k_declare -i POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
_p9k_declare -i POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
_p9k_declare -s POWERLEVEL9K_IP_INTERFACE ""
|
|
|
|
_p9k_declare -s POWERLEVEL9K_IP_INTERFACE ""
|
|
|
|
: ${_POWERLEVEL9K_IP_INTERFACE:='.*'}
|
|
|
|
: ${_POWERLEVEL9K_IP_INTERFACE:='.*'}
|
|
|
|