diff --git a/functions/_tide_item_pwd.fish b/functions/_tide_item_pwd.fish index 2b4ed62..da0685e 100644 --- a/functions/_tide_item_pwd.fish +++ b/functions/_tide_item_pwd.fish @@ -28,18 +28,18 @@ function _tide_item_pwd set -l pwdMaxLength (math $COLUMNS -$tide_pwd_truncate_margin) for i in (seq (count $splitPwd)) - set -l parentDir (string join '/' $splitPwd[1..(math $i-1)]) + set -l parentDir (string join '/' $splitPwd[1..(math $i-1)] | string replace '~' $HOME) + + # Returns true if any markers exist in splitPwd[$i], or if anchorDirs contains i + if test -z thisIsFalse (string split -m 2 " " -- "-o -e "$parentDir/$tide_pwd_markers) || + contains $i $anchorDirs - # This line returns true if any markers exist in splitPwd[$i], or if anchorDirs contains i - if eval test -z thisPartIsFalse "-o -e $parentDir"/$splitPwd[$i]/$tide_pwd_markers || contains $i $anchorDirs set splitPwdForOutput[$i] $colorAnchors$splitPwd[$i]$keepBackgroundColor$colorDirs else if test (string join '/' $splitPwdForLength | string length) -gt $pwdMaxLength set -l truncationLength 1 while set -l truncated (string sub --length $truncationLength $splitPwd[$i]) test (string length $truncated) -lt (string length $splitPwdForLength[$i]) || break - - eval set -l truncatedPath $parentDir/$truncated - test (count $truncatedPath*/) -gt 1 || break + test (count $parentDir/$truncated*/) -gt 1 || break set truncationLength (math $truncationLength + 1) end