Add dir_truncate_root option

This commit is contained in:
Benoit Averty 2016-08-10 00:07:04 +02:00 committed by Dominik Ritter
commit ebf808c533
2 changed files with 30 additions and 2 deletions

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
}