mirror of
https://github.com/romkatv/powerlevel10k
synced 2024-12-12 00:56:41 +00:00
force icon initialization if print_icon is called manually
This commit is contained in:
parent
a7a377339a
commit
f5c2bf1669
@ -17,7 +17,12 @@ typeset -gAH icons
|
|||||||
set_default POWERLEVEL9K_HIDE_BRANCH_ICON false
|
set_default POWERLEVEL9K_HIDE_BRANCH_ICON false
|
||||||
set_default POWERLEVEL9K_MODE ""
|
set_default POWERLEVEL9K_MODE ""
|
||||||
|
|
||||||
|
typeset -gi _P9K_ICONS_INITIALIZED=0
|
||||||
|
|
||||||
function _p9k_init_icons() {
|
function _p9k_init_icons() {
|
||||||
|
(( _P9K_ICONS_INITIALIZED )) && return
|
||||||
|
_P9K_ICONS_INITIALIZED=1
|
||||||
|
|
||||||
case $POWERLEVEL9K_MODE in
|
case $POWERLEVEL9K_MODE in
|
||||||
'flat'|'awesome-patched')
|
'flat'|'awesome-patched')
|
||||||
# Awesome-Patched Font required! See:
|
# Awesome-Patched Font required! See:
|
||||||
@ -548,6 +553,7 @@ function _p9k_init_icons() {
|
|||||||
# Safety function for printing icons
|
# Safety function for printing icons
|
||||||
# Prints the named icon, or if that icon is undefined, the string name.
|
# Prints the named icon, or if that icon is undefined, the string name.
|
||||||
function print_icon() {
|
function print_icon() {
|
||||||
|
_p9k_init_icons
|
||||||
local icon_name=$1
|
local icon_name=$1
|
||||||
local var_name=POWERLEVEL9K_${icon_name}
|
local var_name=POWERLEVEL9K_${icon_name}
|
||||||
if [[ -n "${(tP)var_name}" ]]; then
|
if [[ -n "${(tP)var_name}" ]]; then
|
||||||
@ -562,6 +568,7 @@ function print_icon() {
|
|||||||
# otherwise "print_icon" is used, which takes the users
|
# otherwise "print_icon" is used, which takes the users
|
||||||
# overrides into account.
|
# overrides into account.
|
||||||
function get_icon_names() {
|
function get_icon_names() {
|
||||||
|
_p9k_init_icons
|
||||||
# Iterate over a ordered list of keys of the icons array
|
# Iterate over a ordered list of keys of the icons array
|
||||||
for key in ${(@kon)icons}; do
|
for key in ${(@kon)icons}; do
|
||||||
echo -n "POWERLEVEL9K_$key: "
|
echo -n "POWERLEVEL9K_$key: "
|
||||||
|
Loading…
Reference in New Issue
Block a user