diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index b5df1e6f..f68ff457 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -13,8 +13,7 @@ 'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' () { - emulate -L zsh - setopt no_unset extended_glob + emulate -L zsh -o extended_glob # Unset all configuration options. This allows you to apply configiguration changes without # restarting zsh. Edit ~/.p10k.zsh and type `source ~/.p10k.zsh`. @@ -23,8 +22,11 @@ autoload -Uz is-at-least && is-at-least 5.1 || return zmodload zsh/langinfo - if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 ]]; then - local LC_ALL=${${(@M)$(locale -a):#*.(utf|UTF)(-|)8}[1]:-en_US.UTF-8} + if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 && $+commands[locale] == 1 ]]; then + local -a loc + if loc=(${(@M)$(locale -a 2>/dev/null):#*.(utf|UTF)(-|)8}) && (( $#loc )); then + local LC_ALL=${loc[(r)(#i)C.UTF(-|)8]:-${loc[(r)(#i)en_US.UTF(-|)8]:-$loc[1]}} + fi fi # The list of segments shown on the left. Fill it with the most important segments. diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh index 40a02060..e53f57e7 100644 --- a/config/p10k-lean-8colors.zsh +++ b/config/p10k-lean-8colors.zsh @@ -13,8 +13,7 @@ 'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' () { - emulate -L zsh - setopt no_unset extended_glob + emulate -L zsh -o extended_glob # Unset all configuration options. This allows you to apply configiguration changes without # restarting zsh. Edit ~/.p10k.zsh and type `source ~/.p10k.zsh`. @@ -23,8 +22,11 @@ autoload -Uz is-at-least && is-at-least 5.1 || return zmodload zsh/langinfo - if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 ]]; then - local LC_ALL=${${(@M)$(locale -a):#*.(utf|UTF)(-|)8}[1]:-en_US.UTF-8} + if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 && $+commands[locale] == 1 ]]; then + local -a loc + if loc=(${(@M)$(locale -a 2>/dev/null):#*.(utf|UTF)(-|)8}) && (( $#loc )); then + local LC_ALL=${loc[(r)(#i)C.UTF(-|)8]:-${loc[(r)(#i)en_US.UTF(-|)8]:-$loc[1]}} + fi fi # The list of segments shown on the left. Fill it with the most important segments. diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index 5c93a2cd..dab917ef 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -13,8 +13,7 @@ 'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' () { - emulate -L zsh - setopt no_unset extended_glob + emulate -L zsh -o extended_glob # Unset all configuration options. This allows you to apply configiguration changes without # restarting zsh. Edit ~/.p10k.zsh and type `source ~/.p10k.zsh`. @@ -23,8 +22,11 @@ autoload -Uz is-at-least && is-at-least 5.1 || return zmodload zsh/langinfo - if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 ]]; then - local LC_ALL=${${(@M)$(locale -a):#*.(utf|UTF)(-|)8}[1]:-en_US.UTF-8} + if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 && $+commands[locale] == 1 ]]; then + local -a loc + if loc=(${(@M)$(locale -a 2>/dev/null):#*.(utf|UTF)(-|)8}) && (( $#loc )); then + local LC_ALL=${loc[(r)(#i)C.UTF(-|)8]:-${loc[(r)(#i)en_US.UTF(-|)8]:-$loc[1]}} + fi fi # The list of segments shown on the left. Fill it with the most important segments. diff --git a/config/p10k-pure.zsh b/config/p10k-pure.zsh index fcae29fc..b2e8dd2f 100644 --- a/config/p10k-pure.zsh +++ b/config/p10k-pure.zsh @@ -24,7 +24,6 @@ () { emulate -L zsh - setopt no_unset autoload -Uz is-at-least && is-at-least 5.1 || return diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index c7cae983..9948b574 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -13,8 +13,7 @@ 'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' () { - emulate -L zsh - setopt no_unset extended_glob + emulate -L zsh -o extended_glob # Unset all configuration options. This allows you to apply configiguration changes without # restarting zsh. Edit ~/.p10k.zsh and type `source ~/.p10k.zsh`. @@ -23,8 +22,11 @@ autoload -Uz is-at-least && is-at-least 5.1 || return zmodload zsh/langinfo - if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 ]]; then - local LC_ALL=${${(@M)$(locale -a):#*.(utf|UTF)(-|)8}[1]:-en_US.UTF-8} + if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 && $+commands[locale] == 1 ]]; then + local -a loc + if loc=(${(@M)$(locale -a 2>/dev/null):#*.(utf|UTF)(-|)8}) && (( $#loc )); then + local LC_ALL=${loc[(r)(#i)C.UTF(-|)8]:-${loc[(r)(#i)en_US.UTF(-|)8]:-$loc[1]}} + fi fi # The list of segments shown on the left. Fill it with the most important segments.