mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-17 21:30:07 +00:00
added a new variable POWERLEVEL9K_SHORTEN_DELIMITER to specifiy the delimiter
This commit is contained in:
parent
2fdbd6158c
commit
f472ba7341
1 changed files with 11 additions and 6 deletions
|
@ -407,18 +407,23 @@ prompt_dir() {
|
|||
local current_path='%~'
|
||||
if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" ]]; then
|
||||
|
||||
if [ -z "$POWERLEVEL9K_SHORTEN_DELIMITER" ]
|
||||
then
|
||||
POWERLEVEL9K_SHORTEN_DELIMITER=".."
|
||||
elif [ "$POWERLEVEL9K_SHORTEN_DELIMITER" = false ]
|
||||
then
|
||||
POWERLEVEL9K_SHORTEN_DELIMITER=""
|
||||
fi
|
||||
|
||||
case "$POWERLEVEL9K_SHORTEN_STRATEGY" in
|
||||
truncate_middle)
|
||||
current_path=$(pwd | sed -e "s,^$HOME,~," | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})\//\1\.\.\2\//g")
|
||||
current_path=$(pwd | sed -e "s,^$HOME,~," | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\2\//g")
|
||||
;;
|
||||
truncate_from_right)
|
||||
current_path=$(pwd | sed -e "s,^$HOME,~," | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+\//\1..\//g")
|
||||
;;
|
||||
truncate_fish_like)
|
||||
current_path=$(pwd | sed -e "s,^$HOME,~," | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+\//\1\//g")
|
||||
current_path=$(pwd | sed -e "s,^$HOME,~," | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\//g")
|
||||
;;
|
||||
*)
|
||||
current_path="%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:.../:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c"
|
||||
current_path="%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:$POWERLEVEL9K_SHORTEN_DELIMITER/:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
Loading…
Reference in a new issue