1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-29 06:40:08 +00:00

support generic POWERLEVEL9K_* parameters for segments with dashes in their names

This commit is contained in:
Roman Perepelitsa 2020-09-01 13:31:05 +02:00
parent 47c842fe8e
commit 3b2f474c9f

View file

@ -467,7 +467,7 @@ _p9k_param() {
if [[ -n $_p9k__ret ]]; then if [[ -n $_p9k__ret ]]; then
_p9k__ret[-1,-1]='' _p9k__ret[-1,-1]=''
else else
if [[ $1 == (#b)prompt_([a-z0-9_]#)(*) ]]; then if [[ ${1//-/_} == (#b)prompt_([a-z0-9_]#)(*) ]]; then
local var=_POWERLEVEL9K_${(U)match[1]}$match[2]_$2 local var=_POWERLEVEL9K_${(U)match[1]}$match[2]_$2
if (( $+parameters[$var] )); then if (( $+parameters[$var] )); then
_p9k__ret=${(P)var} _p9k__ret=${(P)var}
@ -7839,7 +7839,7 @@ function _p9k_init_cacheable() {
local -i i=0 local -i i=0
for i in {1..$#_p9k_line_segments_left}; do for i in {1..$#_p9k_line_segments_left}; do
for elem in ${${(@0)_p9k_line_segments_left[i]}%_joined}; do for elem in ${${${(@0)_p9k_line_segments_left[i]}%_joined}//-/_}; do
local var=POWERLEVEL9K_${(U)elem}_SHOW_ON_COMMAND local var=POWERLEVEL9K_${(U)elem}_SHOW_ON_COMMAND
(( $+parameters[$var] )) || continue (( $+parameters[$var] )) || continue
_p9k_show_on_command+=( _p9k_show_on_command+=(
@ -7847,7 +7847,7 @@ function _p9k_init_cacheable() {
$((1+_p9k_display_k[$i/left/$elem])) $((1+_p9k_display_k[$i/left/$elem]))
_p9k__${i}l$elem) _p9k__${i}l$elem)
done done
for elem in ${${(@0)_p9k_line_segments_right[i]}%_joined}; do for elem in ${${${(@0)_p9k_line_segments_right[i]}%_joined}//-/_}; do
local var=POWERLEVEL9K_${(U)elem}_SHOW_ON_COMMAND local var=POWERLEVEL9K_${(U)elem}_SHOW_ON_COMMAND
(( $+parameters[$var] )) || continue (( $+parameters[$var] )) || continue
local cmds=(${(P)var}) local cmds=(${(P)var})