summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorRoman Perepelitsa <roman.perepelitsa@gmail.com>2021-03-28 10:54:30 +0300
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2021-03-28 10:54:30 +0300
commiteafd78c3e0e19022612508e2ded2c1f035c29a25 (patch)
tree511b667a460e206d1fd30acbf70eebaa4646be4e /internal
parentd3de2e558cc12edc012a868ef11cd0dfb6d03a68 (diff)
respect POWERLEVEL9K_SHORTEN_DIR_LENGTH when POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_last
Diffstat (limited to 'internal')
-rw-r--r--internal/p10k.zsh7
1 files changed, 5 insertions, 2 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index e5f8be76..ea7b63c5 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -1768,9 +1768,12 @@ prompt_dir() {
fi
;;
truncate_to_last)
- if [[ $#parts -gt 2 || $p[1] != / && $#parts -gt 1 ]]; then
+ shortenlen=${_POWERLEVEL9K_SHORTEN_DIR_LENGTH:-1}
+ (( shortenlen > 0 )) || shortenlen=1
+ local -i i='shortenlen+1'
+ if [[ $#parts -gt i || $p[1] != / && $#parts -gt shortenlen ]]; then
fake_first=1
- parts[1,-2]=()
+ parts[1,-i]=()
fi
;;
truncate_to_first_and_last)