diff options
author | Alex LaFroscia <alex@lafroscia.com> | 2016-03-18 01:00:20 +0300 |
---|---|---|
committer | Alex LaFroscia <alex@lafroscia.com> | 2016-03-22 20:14:10 +0300 |
commit | 4ca6938801daf7158edc3b8e1922aa748d07eb18 (patch) | |
tree | 189195c14d5e04747f1e75c1244cbcdd2cbca173 /functions | |
parent | daa7255e85e939293bca28e93c8a058425368243 (diff) |
Apply max dir length to package name shortener
Diffstat (limited to 'functions')
-rw-r--r-- | functions/utilities.zsh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/functions/utilities.zsh b/functions/utilities.zsh index 5ca5b431..eed6ccc5 100644 --- a/functions/utilities.zsh +++ b/functions/utilities.zsh @@ -186,3 +186,9 @@ function segmentShouldBeJoined() { return 1 fi } + +# 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" +} |