From 4ca6938801daf7158edc3b8e1922aa748d07eb18 Mon Sep 17 00:00:00 2001 From: Alex LaFroscia Date: Thu, 17 Mar 2016 18:00:20 -0400 Subject: Apply max dir length to package name shortener --- functions/utilities.zsh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'functions/utilities.zsh') 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" +} -- cgit v1.2.3