mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-12 19:18:28 +02:00
allow prompt segments to be disabled through configuration options
Prompt segment `foo` doesn't get evaluated or shown on the left if `${POWERLEVEL9K_FOO_LEFT_DISABLED-$POWERLEVEL9K_FOO_DISABLED}` is equal to `true`. Example: POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(dir) - By default `dir` is shown on the left and on the right. - `POWERLEVEL9K_DIR_LEFT_DISABLED=true` disables `dir` on the left. - `POWERLEVEL9K_DIR_RIGHT_DISABLED=true` disables `dir` on the right. - `POWERLEVEL9K_DIR_DISABLED=true` disables `dir` everywhere. Note that it's possible to hide segments without disabling their evaluation through expansions. For example: POWERLEVEL9K_DIR_CONTENT_EXPANSION='${HIDE_DIR-$P9K_CONTENT}' POWERLEVEL9K_DIR_VISUAL_IDENTIFIER_EXPANSION='${HIDE_DIR-$P9K_VISUAL_IDENTIFIER}' With these settings, `HIDE_DIR=''` hides `dir` while `unset HIDE_DIR` restores it. fixes #205
This commit is contained in:
parent
91b715f18f
commit
9a8a6ca836
@ -3785,6 +3785,30 @@ _p9k_init_params() {
|
|||||||
#
|
#
|
||||||
# These correspond to `java -fullversion` and `java -version` respectively.
|
# These correspond to `java -fullversion` and `java -version` respectively.
|
||||||
_p9k_declare -b POWERLEVEL9K_JAVA_VERSION_FULL 1
|
_p9k_declare -b POWERLEVEL9K_JAVA_VERSION_FULL 1
|
||||||
|
|
||||||
|
local -i i=1
|
||||||
|
while (( i <= $#_POWERLEVEL9K_LEFT_PROMPT_ELEMENTS )); do
|
||||||
|
local segment=${(U)_POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[i]}
|
||||||
|
local var=POWERLEVEL9K_${segment}_LEFT_DISABLED
|
||||||
|
(( $+parameters[$var] )) || var=POWERLEVEL9K_${segment}_DISABLED
|
||||||
|
if [[ ${(P)var} == true ]]; then
|
||||||
|
_POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[i,i]=()
|
||||||
|
else
|
||||||
|
(( ++i ))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
local -i i=1
|
||||||
|
while (( i <= $#_POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS )); do
|
||||||
|
local segment=${(U)_POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[i]}
|
||||||
|
local var=POWERLEVEL9K_${segment}_RIGHT_DISABLED
|
||||||
|
(( $+parameters[$var] )) || var=POWERLEVEL9K_${segment}_DISABLED
|
||||||
|
if [[ ${(P)var} == true ]]; then
|
||||||
|
_POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[i,i]=()
|
||||||
|
else
|
||||||
|
(( ++i ))
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
typeset -ga __p9k_wrapped_zle_widgets
|
typeset -ga __p9k_wrapped_zle_widgets
|
||||||
|
Loading…
Reference in New Issue
Block a user