aboutsummaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-07-18 17:29:45 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-07-18 17:29:45 +0300
commitebb08c881f60d180f40b828cdec904dd14b233eb (patch)
tree1955af75b589a21e67535a450cd98f70294a4d08 /internal/p10k.zsh
parentff24a9f42b3c5650ff51fe10d6adb2ba9c698c4a (diff)
add POWERLEVEL9K_DIR_SHORTENED_FOREGROUND
Diffstat (limited to 'internal/p10k.zsh')
-rwxr-xr-xinternal/p10k.zsh23
1 files changed, 18 insertions, 5 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 61f4a653..3ab029c1 100755
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -1167,9 +1167,10 @@ prompt_dir() {
local -i saved=$(($#dir - j - d))
if (( saved > 0 )); then
if (( q )); then
- parts[i]='${${${_P9K_M:#-*}:+${(Q)${:-'${(qqq)${(q)dir}}'}}}:-${(Q)${:-'${(qqq)${(q)dir[1,j]}}$'}}\1''${$((_P9K_M+='$saved'))+}}'
+ parts[i]='${${${_P9K_M:#-*}:+${(Q)${:-'${(qqq)${(q)dir}}'}}}:-${(Q)${:-'
+ parts[i]+=$'\3'${(qqq)${(q)dir[1,j]}}$'}}\1\3''${$((_P9K_M+='$saved'))+}}'
else
- parts[i]='${${${_P9K_M:#-*}:+'$dir'}:-'$dir[1,j]$'\1''${$((_P9K_M+='$saved'))+}}'
+ parts[i]='${${${_P9K_M:#-*}:+'$dir$'}:-\3'$dir[1,j]$'\1\3''${$((_P9K_M+='$saved'))+}}'
fi
else
(( q )) && parts[i]="\${(Q)\${:-${(qqq)${(q)dir}}}}"
@@ -1277,9 +1278,21 @@ prompt_dir() {
parts=("${(@)parts/$'\2'}")
fi
- (( expand )) && _p9k_escape $delim || _P9K_RETVAL=$delim
- [[ $_P9K_RETVAL == *%* ]] && _P9K_RETVAL+=$style
- parts=("${(@)parts//$'\1'/$_P9K_RETVAL}")
+ if (( $+POWERLEVEL9K_DIR_SHORTENED_FOREGROUND )); then
+ _p9k_translate_color $POWERLEVEL9K_DIR_SHORTENED_FOREGROUND
+ _p9k_foreground $_P9K_RETVAL
+ (( expand )) && _p9k_escape_rcurly $_P9K_RETVAL
+ local shortened_fg=$_P9K_RETVAL
+ (( expand )) && _p9k_escape $delim || _P9K_RETVAL=$delim
+ [[ $_P9K_RETVAL == *%* ]] && _P9K_RETVAL+=$style$shortened_fg
+ parts=("${(@)parts/(#b)$'\3'(*)$'\1'(*)$'\3'/$shortened_fg$match[1]$_P9K_RETVAL$match[2]$style}")
+ parts=("${(@)parts/(#b)(*)$'\1'(*)/$shortened_fg$match[1]$_P9K_RETVAL$match[2]$style}")
+ else
+ (( expand )) && _p9k_escape $delim || _P9K_RETVAL=$delim
+ [[ $_P9K_RETVAL == *%* ]] && _P9K_RETVAL+=$style
+ parts=("${(@)parts/$'\1'/$_P9K_RETVAL}")
+ parts=("${(@)parts//$'\3'}")
+ fi
local sep=''
if [[ -n $POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND ]]; then