summaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorChristo Kotze <onaforeignshore@hotmail.co.uk>2018-02-18 15:29:05 +0300
committerChristo Kotze <onaforeignshore@hotmail.co.uk>2018-02-18 15:29:05 +0300
commitb1b0ad949a0ee558fa6b6c25882b961c8200a9eb (patch)
treed3dbefb3e20cf817a8a1854de5e273862fde0a78 /powerlevel9k.zsh-theme
parent4f1da4a64dcbd0923d591ffda50ce1f5d2870ce2 (diff)
Updated truncate_from_right test
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme5
1 files changed, 2 insertions, 3 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 2e483844..0f6461c3 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -723,8 +723,7 @@ set_default POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD false
# * $1 Alignment: string - left|right
# * $2 Index: integer
prompt_dir() {
- local current_dir="$(echo $PWD)"
- current_dir=${current_dir//$HOME/"~"}
+ local current_dir="$(print -P '%~')"
local paths
[[ current_dir != "/" ]] && paths=(${(s:/:)current_dir}) # only split if not root folder
local cur_path cur_short_path directory dir_length cur_dir
@@ -762,7 +761,7 @@ prompt_dir() {
cur_dir=$directory
dir_length=${#cur_dir}
local threshhold=$(( $POWERLEVEL9K_SHORTEN_DIR_LENGTH + ${#delim} ))
- if (( $dir_length > $threshhold )) && [[ $cur_dir != $paths[${#paths}] ]]; then # only shorten if long enough and not last path
+ if (( ( $dir_length + 1) > $threshhold )) && [[ $cur_dir != $paths[${#paths}] ]]; then # only shorten if long enough and not last path
cur_dir=${cur_dir:0:$POWERLEVEL9K_SHORTEN_DIR_LENGTH}$delim
fi
cur_short_path+="$cur_dir/"