diff options
author | Ben Hilburn <bhilburn@gmail.com> | 2016-04-11 22:16:37 +0300 |
---|---|---|
committer | Ben Hilburn <bhilburn@gmail.com> | 2016-04-11 22:16:37 +0300 |
commit | aec9d95295ef3966b835455c3340aa5f8b9367d9 (patch) | |
tree | d5b84dc5c71ebebe9322a2ea87a24d1c4049f8bd /functions | |
parent | b6e8e20b65a9242e22c1e72a60e1bfa35c03f6e3 (diff) | |
parent | 4ca6938801daf7158edc3b8e1922aa748d07eb18 (diff) |
Merge pull request #229 from alexlafroscia/add-package-name-shortening-strategy
Add shortening strategy based on package.json name
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" +} |