|
|
@ -792,9 +792,6 @@ set_default POWERLEVEL9K_DIR_SHOW_WRITABLE false
|
|
|
|
set_default POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER false
|
|
|
|
set_default POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER false
|
|
|
|
set_default POWERLEVEL9K_SHORTEN_STRATEGY ""
|
|
|
|
set_default POWERLEVEL9K_SHORTEN_STRATEGY ""
|
|
|
|
set_default POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND ""
|
|
|
|
set_default POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND ""
|
|
|
|
# This defines a pattern. It is expanded with the options set by `emulate zsh`.
|
|
|
|
|
|
|
|
# This works pretty well: POWERLEVEL9K_SHORTEN_FOLDER_MARKER="(.bzr|CVS|.git|.hg|.svn|.citc)"
|
|
|
|
|
|
|
|
set_default POWERLEVEL9K_SHORTEN_FOLDER_MARKER ".shorten_folder_marker"
|
|
|
|
|
|
|
|
set_default -i POWERLEVEL9K_SHORTEN_DIR_LENGTH -1
|
|
|
|
set_default -i POWERLEVEL9K_SHORTEN_DIR_LENGTH -1
|
|
|
|
# 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
|
|
|
@ -895,33 +892,46 @@ prompt_dir() {
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
truncate_to_unique)
|
|
|
|
truncate_to_unique)
|
|
|
|
local parent="${PWD%/${(pj./.)parts[2,-1]}}" dir=''
|
|
|
|
local -i i=2 n=1
|
|
|
|
local -i i=2
|
|
|
|
[[ $p == /* ]] && (( ++i ))
|
|
|
|
for (( ; i < $#parts; ++i )); do
|
|
|
|
(( POWERLEVEL9K_SHORTEN_DIR_LENGTH > 0 )) && n=POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
|
|
|
|
local pat=${POWERLEVEL9K_SHORTEN_FOLDER_MARKER-'(.bzr|CVS|.git|.hg|.svn|.citc)'}
|
|
|
|
|
|
|
|
local parent="${PWD%/${(pj./.)parts[i,-1]}}"
|
|
|
|
|
|
|
|
for (( ; i <= $#parts - n; ++i )); do
|
|
|
|
local dir=$parts[i]
|
|
|
|
local dir=$parts[i]
|
|
|
|
|
|
|
|
if [[ -n $pat ]]; then
|
|
|
|
|
|
|
|
local -a matches=($parent/$dir/${~pat}(N))
|
|
|
|
|
|
|
|
if (( $#matches )); then
|
|
|
|
|
|
|
|
parent+=/$dir
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
local -i j=1
|
|
|
|
local -i j=1
|
|
|
|
for (( ; j < $#dir; ++j )); do
|
|
|
|
for (( ; j < $#dir; ++j )); do
|
|
|
|
local -a matching=($parent/$dir[1,j]*/(N))
|
|
|
|
local -a matching=($parent/$dir[1,j]*/(N))
|
|
|
|
(( $#matching == 1 )) && break
|
|
|
|
(( $#matching == 1 )) && break
|
|
|
|
done
|
|
|
|
done
|
|
|
|
parent+=/$dir
|
|
|
|
|
|
|
|
(( j == $#dir )) || parts[i]=$dir[1,j]$'\0'
|
|
|
|
(( j == $#dir )) || parts[i]=$dir[1,j]$'\0'
|
|
|
|
|
|
|
|
parent+=/$dir
|
|
|
|
done
|
|
|
|
done
|
|
|
|
delim=${POWERLEVEL9K_SHORTEN_DELIMITER-'*'}
|
|
|
|
delim=${POWERLEVEL9K_SHORTEN_DELIMITER-'*'}
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
truncate_with_folder_marker)
|
|
|
|
truncate_with_folder_marker)
|
|
|
|
|
|
|
|
local pat=${POWERLEVEL9K_SHORTEN_FOLDER_MARKER-.shorten_folder_marker}
|
|
|
|
|
|
|
|
if [[ -n $pat ]]; then
|
|
|
|
local dir=$PWD
|
|
|
|
local dir=$PWD
|
|
|
|
local -a m=()
|
|
|
|
local -a m=()
|
|
|
|
local -i i=$(($#parts - 1))
|
|
|
|
local -i i=$(($#parts - 1))
|
|
|
|
for (( ; i > 1; --i )); do
|
|
|
|
for (( ; i > 1; --i )); do
|
|
|
|
dir=${dir:h}
|
|
|
|
dir=${dir:h}
|
|
|
|
local -a matches=($dir/${~POWERLEVEL9K_SHORTEN_FOLDER_MARKER}(N))
|
|
|
|
local -a matches=($dir/${~pat}(N))
|
|
|
|
(( $#matches )) && m+=$i
|
|
|
|
(( $#matches )) && m+=$i
|
|
|
|
done
|
|
|
|
done
|
|
|
|
m+=1
|
|
|
|
m+=1
|
|
|
|
for (( i=1; i < $#m; ++i )); do
|
|
|
|
for (( i=1; i < $#m; ++i )); do
|
|
|
|
(( m[i] - m[i+1] > 2 )) && parts[m[i+1]+1,m[i]-1]=($'\0')
|
|
|
|
(( m[i] - m[i+1] > 2 )) && parts[m[i+1]+1,m[i]-1]=($'\0')
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
*)
|
|
|
|
if (( POWERLEVEL9K_SHORTEN_DIR_LENGTH > 0 )); then
|
|
|
|
if (( POWERLEVEL9K_SHORTEN_DIR_LENGTH > 0 )); then
|
|
|
|