|
|
@ -759,6 +759,12 @@ set_default POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND ""
|
|
|
|
# Individual elements are patterns. They are expanded with the options set by `emulate zsh`.
|
|
|
|
# Individual elements are patterns. They are expanded with the options set by `emulate zsh`.
|
|
|
|
set_default -a POWERLEVEL9K_DIR_PACKAGE_FILES package.json composer.json
|
|
|
|
set_default -a POWERLEVEL9K_DIR_PACKAGE_FILES package.json composer.json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _p9k_shorten_delim_len() {
|
|
|
|
|
|
|
|
local def=$1
|
|
|
|
|
|
|
|
_P9K_RETVAL=${POWERLEVEL9K_SHORTEN_DELIMITER_LENGTH:--1}
|
|
|
|
|
|
|
|
(( _P9K_RETVAL >= 0 )) || _p9k_prompt_length $1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
################################################################
|
|
|
|
################################################################
|
|
|
|
# Dir: current working directory
|
|
|
|
# Dir: current working directory
|
|
|
|
prompt_dir() {
|
|
|
|
prompt_dir() {
|
|
|
@ -791,11 +797,12 @@ prompt_dir() {
|
|
|
|
local -i fake_first=0
|
|
|
|
local -i fake_first=0
|
|
|
|
local delim=${POWERLEVEL9K_SHORTEN_DELIMITER-$'\u2026'}
|
|
|
|
local delim=${POWERLEVEL9K_SHORTEN_DELIMITER-$'\u2026'}
|
|
|
|
local -i shortenlen=${POWERLEVEL9K_SHORTEN_DIR_LENGTH:--1}
|
|
|
|
local -i shortenlen=${POWERLEVEL9K_SHORTEN_DIR_LENGTH:--1}
|
|
|
|
local -i d=${POWERLEVEL9K_SHORTEN_DELIMITER_LENGTH:-$#POWERLEVEL9K_SHORTEN_DELIMITER}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case $POWERLEVEL9K_SHORTEN_STRATEGY in
|
|
|
|
case $POWERLEVEL9K_SHORTEN_STRATEGY in
|
|
|
|
truncate_absolute|truncate_absolute_chars)
|
|
|
|
truncate_absolute|truncate_absolute_chars)
|
|
|
|
if (( shortenlen > 0 && $#p > shortenlen + d )); then
|
|
|
|
if (( shortenlen > 0 && $#p > shortenlen )); then
|
|
|
|
|
|
|
|
_p9k_shorten_delim_len $delim
|
|
|
|
|
|
|
|
if (( $#p > shortenlen + $_P9K_RETVAL )); then
|
|
|
|
local -i n=shortenlen
|
|
|
|
local -i n=shortenlen
|
|
|
|
local -i i=$#parts
|
|
|
|
local -i i=$#parts
|
|
|
|
while true; do
|
|
|
|
while true; do
|
|
|
@ -811,6 +818,7 @@ prompt_dir() {
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
truncate_with_package_name|truncate_middle|truncate_from_right)
|
|
|
|
truncate_with_package_name|truncate_middle|truncate_from_right)
|
|
|
|
() {
|
|
|
|
() {
|
|
|
@ -832,7 +840,8 @@ prompt_dir() {
|
|
|
|
done
|
|
|
|
done
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (( shortenlen > 0 )); then
|
|
|
|
if (( shortenlen > 0 )); then
|
|
|
|
local -i pref=$shortenlen suf=0 i=2
|
|
|
|
_p9k_shorten_delim_len $delim
|
|
|
|
|
|
|
|
local -i d=_P9K_RETVAL pref=shortenlen suf=0 i=2
|
|
|
|
[[ $POWERLEVEL9K_SHORTEN_STRATEGY == truncate_middle ]] && suf=pref
|
|
|
|
[[ $POWERLEVEL9K_SHORTEN_STRATEGY == truncate_middle ]] && suf=pref
|
|
|
|
for (( ; i < $#parts; ++i )); do
|
|
|
|
for (( ; i < $#parts; ++i )); do
|
|
|
|
local dir=$parts[i]
|
|
|
|
local dir=$parts[i]
|
|
|
@ -860,6 +869,8 @@ prompt_dir() {
|
|
|
|
local -i i=2 n=1
|
|
|
|
local -i i=2 n=1
|
|
|
|
[[ $p == /* ]] && (( ++i ))
|
|
|
|
[[ $p == /* ]] && (( ++i ))
|
|
|
|
delim=${POWERLEVEL9K_SHORTEN_DELIMITER-'*'}
|
|
|
|
delim=${POWERLEVEL9K_SHORTEN_DELIMITER-'*'}
|
|
|
|
|
|
|
|
_p9k_shorten_delim_len $delim
|
|
|
|
|
|
|
|
local -i d=_P9K_RETVAL
|
|
|
|
shortenlen=${POWERLEVEL9K_SHORTEN_DIR_LENGTH:-1}
|
|
|
|
shortenlen=${POWERLEVEL9K_SHORTEN_DIR_LENGTH:-1}
|
|
|
|
(( shortenlen >= 0 )) && n=shortenlen
|
|
|
|
(( shortenlen >= 0 )) && n=shortenlen
|
|
|
|
local pat=${POWERLEVEL9K_SHORTEN_FOLDER_MARKER-'(.bzr|CVS|.git|.hg|.svn|.citc)'}
|
|
|
|
local pat=${POWERLEVEL9K_SHORTEN_FOLDER_MARKER-'(.bzr|CVS|.git|.hg|.svn|.citc)'}
|
|
|
|