From e42cb50052c8f7f4d56b4842270e5104f5f82021 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sun, 19 Mar 2017 17:23:48 +0100 Subject: [PATCH 1/2] Sort the output of `get_icon_names` alphabetically --- functions/icons.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/icons.zsh b/functions/icons.zsh index 26412543..627d0cef 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -301,7 +301,8 @@ function print_icon() { } get_icon_names() { - for key in ${(@k)icons}; do + # Iterate over a ordered list of keys of the icons array + for key in ${(@kon)icons}; do echo "POWERLEVEL9K_$key: ${icons[$key]}" done } From f89104f68f1598d89fe35956060a6410744a5be8 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sun, 19 Mar 2017 17:55:11 +0100 Subject: [PATCH 2/2] Improve get_icon_names function As this function gets more and more important, it now checks for overrides the user has made and prints these icons instead. At least unless the first parameter is not set to "original". Then it will print the default icons. --- functions/icons.zsh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/functions/icons.zsh b/functions/icons.zsh index 627d0cef..475c0b96 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -300,9 +300,20 @@ function print_icon() { fi } +# Get a list of configured icons +# * $1 string - If "original", then the original icons are printed, +# otherwise "print_icon" is used, which takes the users +# overrides into account. get_icon_names() { # Iterate over a ordered list of keys of the icons array for key in ${(@kon)icons}; do - echo "POWERLEVEL9K_$key: ${icons[$key]}" + echo -n "POWERLEVEL9K_$key: " + if [[ "${1}" == "original" ]]; then + # print the original icons as they are defined in the array above + echo "${icons[$key]}" + else + # print the icons as they are configured by the user + echo "$(print_icon "$key")" + fi done }