Add dir_truncate_root option

This commit is contained in:
Benoit Averty
2017-01-31 23:47:49 +01:00
committed by Dominik Ritter
parent a58e8bdc8c
commit ebf808c533
2 changed files with 30 additions and 2 deletions
+15
View File
@@ -208,3 +208,18 @@ function truncatePathFromRight() {
echo $1 | sed $SED_EXTENDED_REGEX_PARAMETER \
"s@(([^/]{$((POWERLEVEL9K_SHORTEN_DIR_LENGTH))})([^/]{$delim_len}))[^/]+/@\2$POWERLEVEL9K_SHORTEN_DELIMITER/@g"
}
# Search recursively in parent folders for given file.
function upsearch () {
if test -e "$1"; then
echo "$PWD"
else
if [[ "$PWD" == "/" || "$PWD" == "$HOME" ]]; then
echo "$PWD";
else
pushd .. > /dev/null
upsearch "$1"
popd > /dev/null
fi
fi
}