From c5816238014d9ec92dc6d0f50014aa82a0af6a29 Mon Sep 17 00:00:00 2001 From: Syphdias Date: Sun, 26 May 2019 23:35:15 +0200 Subject: [PATCH] adds POWERLEVEL9K_SHORTEN_DELIMITER_LENGTH for truncate_to_unique --- powerlevel9k.zsh-theme | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 388141f9..ee5b6564 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -835,8 +835,9 @@ prompt_dir() { fi ;; truncate_to_unique) - local -i i=2 n=1 + local -i i=2 n=1 d=0 delim=${POWERLEVEL9K_SHORTEN_DELIMITER-'*'} + d=${POWERLEVEL9K_SHORTEN_DELIMITER_LENGTH:-$#POWERLEVEL9K_SHORTEN_DELIMITER} (( 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]}}" @@ -850,11 +851,11 @@ prompt_dir() { fi fi local -i j=1 - for (( ; j + $#delim < $#dir; ++j )); do + for (( ; j + d < $#dir; ++j )); do local -a matching=($parent/$dir[1,j]*/(N)) (( $#matching == 1 )) && break done - (( j + $#delim >= $#dir )) || parts[i]=$dir[1,j]$'\0' + (( j + d >= $#dir )) || parts[i]=$dir[1,j]$'\0' parent+=/$dir done ;;