diff options
author | Ben Hilburn <bhilburn@gmail.com> | 2016-10-27 18:00:18 +0300 |
---|---|---|
committer | Ben Hilburn <bhilburn@gmail.com> | 2016-10-27 18:00:18 +0300 |
commit | 352ad4d60833cc36f8835fb2926d41813c495691 (patch) | |
tree | 6740c955a74c4a6d1c8021d267e5280b1b6d468e /functions | |
parent | b54abe48dc080a595224f91f123245ca3e28ba9f (diff) | |
parent | fd9c998f02966229d0dfa576d0056bae21267a2a (diff) |
Merge branch 'master' into next
Diffstat (limited to 'functions')
-rw-r--r-- | functions/utilities.zsh | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/functions/utilities.zsh b/functions/utilities.zsh index c9bd2e46..f27c7f99 100644 --- a/functions/utilities.zsh +++ b/functions/utilities.zsh @@ -204,5 +204,7 @@ function segmentShouldBeJoined() { # Given a directory path, truncate it according to the settings for # `truncate_from_right` function truncatePathFromRight() { - echo $1 | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\//g" + local delim_len=${#POWERLEVEL9K_SHORTEN_DELIMITER} + echo $1 | sed $SED_EXTENDED_REGEX_PARAMETER \ + "s@(([^/]{$((POWERLEVEL9K_SHORTEN_DIR_LENGTH))})([^/]{$delim_len}))[^/]+/@\2$POWERLEVEL9K_SHORTEN_DELIMITER/@g" } |