aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorDaniel Tam <danooo.tam@gmail.com>2018-02-13 14:18:26 +0300
committerDaniel Tam <danooo.tam@gmail.com>2018-02-13 14:18:26 +0300
commiteb1c6ec1fc6ac9310b815296dd791fe798ec74a8 (patch)
treebdbac650483e58ea201baf693e4fe817dc3d395d /powerlevel9k.zsh-theme
parent04850df7504326e06588bbbde4213137c9360e88 (diff)
Refactor absolute char truncation
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme4
1 files changed, 1 insertions, 3 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 4224075e..d66787c1 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -730,10 +730,8 @@ prompt_dir() {
case "$POWERLEVEL9K_SHORTEN_STRATEGY" in
truncate_absolute_chars)
if [ ${#current_path} -gt $(( $POWERLEVEL9K_SHORTEN_DIR_LENGTH + ${#POWERLEVEL9K_SHORTEN_DELIMITER} )) ]; then
- current_path=$(echo $current_path | rev | cut -c 1-$POWERLEVEL9K_SHORTEN_DIR_LENGTH | rev | cat <(echo -n $POWERLEVEL9K_SHORTEN_DELIMITER) -)
+ current_path=$POWERLEVEL9K_SHORTEN_DELIMITER${current_path:(-POWERLEVEL9K_SHORTEN_DIR_LENGTH)}
fi
- # Alternative implementation
- #current_path="%$POWERLEVEL9K_SHORTEN_DIR_LENGTH<$POWERLEVEL9K_SHORTEN_DELIMITER<%~%<<"
;;
truncate_middle)
current_path=$(echo "$current_path" | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\2\//g")