mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-11 00:00:06 +00:00
Now printing a warning if $LANG is set incorrectly.
This commit is contained in:
parent
1c9ec53d58
commit
4666bd49e6
1 changed files with 11 additions and 1 deletions
|
@ -1052,13 +1052,23 @@ powerlevel9k_init() {
|
||||||
# Display a warning if the terminal does not support 256 colors
|
# Display a warning if the terminal does not support 256 colors
|
||||||
local term_colors
|
local term_colors
|
||||||
term_colors=$(echotc Co)
|
term_colors=$(echotc Co)
|
||||||
if (( term_colors < 256 )); then
|
if (( $term_colors < 256 )); then
|
||||||
print -P "%F{red}WARNING!%f Your terminal appears to support less than 256 colors!"
|
print -P "%F{red}WARNING!%f Your terminal appears to support less than 256 colors!"
|
||||||
print -P "If your terminal supports 256 colors, please export the appropriate environment variable"
|
print -P "If your terminal supports 256 colors, please export the appropriate environment variable"
|
||||||
print -P "_before_ loading this theme in your \~\/.zshrc. In most terminal emulators, putting"
|
print -P "_before_ loading this theme in your \~\/.zshrc. In most terminal emulators, putting"
|
||||||
print -P "%F{blue}export TERM=\"xterm-256color\"%f at the top of your \~\/.zshrc is sufficient."
|
print -P "%F{blue}export TERM=\"xterm-256color\"%f at the top of your \~\/.zshrc is sufficient."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If the terminal `LANG` is set to `C`, this theme will not work at all.
|
||||||
|
local term_lang
|
||||||
|
term_lang=$(echo $LANG)
|
||||||
|
if [[ $term_lang == 'C' ]]; then
|
||||||
|
print -P "\t%F{red}WARNING!%f Your terminal's 'LANG' is set to 'C', which breaks this theme!"
|
||||||
|
print -P "\t%F{red}WARNING!%f Please set your 'LANG' to a UTF-8 language, like 'en_US.UTF-8'"
|
||||||
|
print -P "\t%F{red}WARNING!%f _before_ loading this theme in your \~\.zshrc. Putting"
|
||||||
|
print -P "\t%F{red}WARNING!%f %F{blue}export LANG=\"en_US.UTF-8\"%f at the top of your \~\/.zshrc is sufficient."
|
||||||
|
fi
|
||||||
|
|
||||||
# Display a warning if deprecated segments are in use.
|
# Display a warning if deprecated segments are in use.
|
||||||
typeset -AH deprecated_segments
|
typeset -AH deprecated_segments
|
||||||
# old => new
|
# old => new
|
||||||
|
|
Loading…
Reference in a new issue