mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-26 00:41:57 +00:00
Merge branch 'master' into worker
This commit is contained in:
commit
f1314f9072
3 changed files with 40 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
|||
# Powerlevel10k
|
||||
[![Gitter](https://badges.gitter.im/powerlevel10k/community.svg)](https://gitter.im/powerlevel10k/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
Powerlevel10k is a theme for ZSH. It's fast, flexible and easy to install and configure.
|
||||
|
||||
|
|
|
@ -1560,7 +1560,12 @@ prompt_dir() {
|
|||
shortenlen=${_POWERLEVEL9K_SHORTEN_DIR_LENGTH:-1}
|
||||
(( shortenlen >= 0 )) || shortenlen=1
|
||||
local -i i=2 e=$(($#parts - shortenlen))
|
||||
[[ $p[1] == / ]] && (( ++i ))
|
||||
if (( _POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER )); then
|
||||
(( e += shortenlen ))
|
||||
local orig=("$parts[2]" "${(@)parts[$((shortenlen > $#parts ? -$#parts : -shortenlen)),-1]}")
|
||||
elif [[ $p[1] == / ]]; then
|
||||
(( ++i ))
|
||||
fi
|
||||
local parent="${_p9k__pwd%/${(pj./.)parts[i,-1]}}"
|
||||
if (( i <= e )); then
|
||||
local MATCH= mtimes=()
|
||||
|
@ -1611,11 +1616,34 @@ prompt_dir() {
|
|||
fi
|
||||
parent+=/$sub
|
||||
done
|
||||
for ((; i <= $#parts; ++i)); do
|
||||
[[ $parts[i] == *["~!#\`\$^&*()\\\"'<>?{}[]"]* ]] && parts[i]='${(Q)${:-'${(qqq)${(q)parts[i]}}'}}'
|
||||
parts[i]+=$'\2'
|
||||
done
|
||||
[[ -n $key ]] && _p9k_cache_ephemeral_set "$key" "${parts[@]}"
|
||||
if (( _POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER )); then
|
||||
local _2=$'\2'
|
||||
(( e = ${parts[(I)*$_2]} ))
|
||||
if (( e > 1 )); then
|
||||
parts[1,e-1]=()
|
||||
fake_first=1
|
||||
elif [[ $p == /?* ]]; then
|
||||
parts[2]="\${(Q)\${:-${(qqq)${(q)orig[1]}}}}"$'\2'
|
||||
fi
|
||||
for ((i = $#parts < shortenlen ? $#parts : shortenlen; i > 0; --i)); do
|
||||
[[ $#parts[-i] == *$'\2' ]] && continue
|
||||
if [[ $orig[-i] == *["~!#\`\$^&*()\\\"'<>?{}[]"]* ]]; then
|
||||
parts[-i]='${(Q)${:-'${(qqq)${(q)orig[-i]}}'}}'$'\2'
|
||||
else
|
||||
parts[-i]=${orig[-i]}$'\2'
|
||||
fi
|
||||
done
|
||||
else
|
||||
for ((; i <= $#parts; ++i)); do
|
||||
[[ $parts[i] == *["~!#\`\$^&*()\\\"'<>?{}[]"]* ]] && parts[i]='${(Q)${:-'${(qqq)${(q)parts[i]}}'}}'
|
||||
parts[i]+=$'\2'
|
||||
done
|
||||
fi
|
||||
if [[ -n $key ]]; then
|
||||
_p9k_cache_ephemeral_set "$key" "${parts[@]}"
|
||||
else
|
||||
_p9k_cache_val=("$key" "${parts[@]}")
|
||||
fi
|
||||
fi
|
||||
parts=("${(@)_p9k_cache_val[2,-1]}")
|
||||
;;
|
||||
|
@ -5204,6 +5232,8 @@ _p9k_init_params() {
|
|||
_p9k_declare -a POWERLEVEL9K_DIR_CLASSES
|
||||
_p9k_declare -i POWERLEVEL9K_SHORTEN_DELIMITER_LENGTH
|
||||
_p9k_declare -e POWERLEVEL9K_SHORTEN_DELIMITER
|
||||
_p9k_declare -b POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER
|
||||
[[ -z $_POWERLEVEL9K_SHORTEN_FOLDER_MARKER ]] && _POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=0
|
||||
_p9k_declare -i POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
||||
_p9k_declare -s POWERLEVEL9K_IP_INTERFACE ""
|
||||
: ${_POWERLEVEL9K_IP_INTERFACE:='.*'}
|
||||
|
|
|
@ -700,15 +700,15 @@ function ask_color() {
|
|||
print -n $nl
|
||||
color=1 print_prompt
|
||||
print -P ""
|
||||
print -P "%B(1) $color_name[2].%b"
|
||||
print -P "%B(2) $color_name[2].%b"
|
||||
print -n $nl
|
||||
color=2 print_prompt
|
||||
print -P ""
|
||||
print -P "%B(1) $color_name[3].%b"
|
||||
print -P "%B(3) $color_name[3].%b"
|
||||
print -n $nl
|
||||
color=3 print_prompt
|
||||
print -P ""
|
||||
print -P "%B(1) $color_name[4].%b"
|
||||
print -P "%B(4) $color_name[4].%b"
|
||||
print -n $nl
|
||||
color=4 print_prompt
|
||||
print -P ""
|
||||
|
|
Loading…
Reference in a new issue