diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index 12ba3c0b..459c243b 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -20,7 +20,7 @@ unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR' # Zsh >= 5.1 is required. - autoload -Uz is-at-least && is-at-least 5.1 || return + [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]] || return # The list of segments shown on the left. Fill it with the most important segments. typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh index 6eaa6564..8157875a 100644 --- a/config/p10k-lean-8colors.zsh +++ b/config/p10k-lean-8colors.zsh @@ -20,7 +20,7 @@ unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR' # Zsh >= 5.1 is required. - autoload -Uz is-at-least && is-at-least 5.1 || return + [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]] || return # The list of segments shown on the left. Fill it with the most important segments. typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index 6b14d3d4..90953751 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -20,7 +20,7 @@ unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR' # Zsh >= 5.1 is required. - autoload -Uz is-at-least && is-at-least 5.1 || return + [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]] || return # The list of segments shown on the left. Fill it with the most important segments. typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( diff --git a/config/p10k-pure.zsh b/config/p10k-pure.zsh index 566c030d..97c1a207 100644 --- a/config/p10k-pure.zsh +++ b/config/p10k-pure.zsh @@ -29,7 +29,7 @@ unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR' # Zsh >= 5.1 is required. - autoload -Uz is-at-least && is-at-least 5.1 || return + [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]] || return # Prompt colors. local grey=242 diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index a72fa65f..2f13370b 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -20,7 +20,7 @@ unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR' # Zsh >= 5.1 is required. - autoload -Uz is-at-least && is-at-least 5.1 || return + [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]] || return # The list of segments shown on the left. Fill it with the most important segments. typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( diff --git a/config/p10k-robbyrussell.zsh b/config/p10k-robbyrussell.zsh index a4cb8b2d..a59e222b 100644 --- a/config/p10k-robbyrussell.zsh +++ b/config/p10k-robbyrussell.zsh @@ -24,7 +24,7 @@ unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR' # Zsh >= 5.1 is required. - autoload -Uz is-at-least && is-at-least 5.1 || return + [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]] || return # Left prompt segments. typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(prompt_char dir vcs) diff --git a/gitstatus/mbuild b/gitstatus/mbuild index d3de3317..40316fdf 100755 --- a/gitstatus/mbuild +++ b/gitstatus/mbuild @@ -94,9 +94,7 @@ setopt no_unset extended_glob pipe_fail prompt_percent typeset_silent \ no_prompt_subst no_prompt_bang pushd_silent warn_create_global -autoload -Uz is-at-least - -if ! is-at-least 5.1 || [[ $ZSH_VERSION == 5.4.* ]]; then +if [[ $ZSH_VERSION != (5.<1->*|<6->.*) || $ZSH_VERSION == 5.4(|.*) ]]; then print -ru2 -- "[error] unsupported zsh version: $ZSH_VERSION" return 1 fi diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 17e9bc89..4e870737 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -20,7 +20,7 @@ if [[ $__p9k_sourced != 13 ]]; then return 1 fi -if ! autoload -Uz is-at-least || ! is-at-least 5.1; then +if [[ $ZSH_VERSION != (5.<1->*|<6->.*) ]]; then () { >&2 echo -E "You are using ZSH version $ZSH_VERSION. The minimum required version for Powerlevel10k is 5.1." >&2 echo -E "Type 'echo \$ZSH_VERSION' to see your current zsh version." @@ -31,7 +31,7 @@ if ! autoload -Uz is-at-least || ! is-at-least 5.1; then >&2 echo -E "The shell you are currently running is likely $cur." fi local other=${${:-zsh}:c} - if [[ -n $other ]] && $other -c 'autoload -Uz is-at-least && is-at-least 5.1' &>/dev/null; then + if [[ -n $other ]] && $other -c '[[ $ZSH_VERSION == (5.<1->*|<6->.*) ]]' &>/dev/null; then local other_v="$($other -c 'echo -E $ZSH_VERSION' 2>/dev/null)" if [[ -n $other_v && $other_v != $ZSH_VERSION ]]; then >&2 echo -E "You have $other with version $other_v but this is not what you are using." @@ -341,7 +341,7 @@ function _p9k_human_readable_bytes() { _p9k__ret=${${_p9k__ret%%0#}%.}$suf } -if is-at-least 5.4; then +if [[ $ZSH_VERSION == (5.<4->*|<6->.*) ]]; then function _p9k_print_params() { typeset -p -- "$@" } else # Cannot use `typeset -p` unconditionally because of bugs in zsh. @@ -7011,14 +7011,14 @@ function _p9k_reset_prompt() { # ZSH_PATCHLEVEL=zsh-5.4.2-159-gd8d9fee13. Released in 5.5. # # Fix: https://github.com/zsh-users/zsh/commit/64d13738357c9b9c212adbe17f271716abbcf6ea. -# ZSH_PATCHLEVEL=zsh-5.7.1-50-g64d137383. +# ZSH_PATCHLEVEL=zsh-5.7.1-50-g64d137383. Released in 5.7.2. # # Test: PROMPT="${(pl:$((COLUMNS))::-:)}<%1(l.%2(l.FAIL.PASS).FAIL)> " zsh -dfis <<= 50 )) - is-at-least 5.5 && ! is-at-least 5.7.2 + [[ $ZSH_VERSION == (5.<5->*|5.<6->*) || $ZSH_VERSION == 5.<7->* && $ZSH_VERSION != 5.7.<2->* ]] } typeset -g _p9k__param_pat @@ -7645,7 +7645,7 @@ function _p9k_on_widget_zle-keymap-select() { _p9k_check_visual_mode; __p9k_rese function _p9k_on_widget_overwrite-mode() { _p9k_check_visual_mode; __p9k_reset_state=2; } function _p9k_on_widget_vi-replace() { _p9k_check_visual_mode; __p9k_reset_state=2; } -if is-at-least 5.3; then +if [[ $ZSH_VERSION == (5.<3->*|<6->.*) ]]; then function _p9k_check_visual_mode() { [[ ${KEYMAP:-} == vicmd ]] || return 0 local region=${${REGION_ACTIVE:-0}/2/1} @@ -7822,7 +7822,7 @@ function _p9k_wrap_widgets() { typeset -gir __p9k_widgets_wrapped=1 local -a widget_list - if is-at-least 5.3; then + if [[ $ZSH_VERSION == (5.<3->*|<6->.*) ]]; then local -aU widget_list=( zle-line-pre-redraw zle-line-init @@ -8168,7 +8168,7 @@ _p9k_init_prompt() { _p9k_all_params_eq '_POWERLEVEL9K_*WHITESPACE_BETWEEN_RIGHT_SEGMENTS' ' ' && _p9k_all_params_eq '_POWERLEVEL9K_*RIGHT_RIGHT_WHITESPACE' ' ' && _p9k_all_params_eq '_POWERLEVEL9K_*RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL' '' && - ! is-at-least 5.7.2; then + [[ $ZSH_VERSION != (5.7.<2->*|<6->.*) ]]; then _p9k_emulate_zero_rprompt_indent=1 _p9k_prompt_prefix_left+='${${:-${_p9k__real_zle_rprompt_indent:=$ZLE_RPROMPT_INDENT}${ZLE_RPROMPT_INDENT::=1}${_p9k__ind::=0}}+}' _p9k_line_suffix_right[-1]='${_p9k__sss:+${_p9k__sss% }%E}}' @@ -8839,7 +8839,7 @@ typeset -gi __p9k_configured=0 typeset -gri __p9k_instant_prompt_disabled=1 # `typeset -g` doesn't roundtrip in zsh prior to 5.4. -if is-at-least 5.4; then +if [[ $ZSH_VERSION == (5.<4->*|<6->.*) ]]; then typeset -gri __p9k_dumps_enabled=1 else typeset -gri __p9k_dumps_enabled=0 diff --git a/internal/wizard.zsh b/internal/wizard.zsh index 2ffb606c..99cf63ad 100644 --- a/internal/wizard.zsh +++ b/internal/wizard.zsh @@ -1449,7 +1449,7 @@ function print_instant_prompt_link() { } function ask_instant_prompt() { - if ! is-at-least 5.4; then + if [[ $ZSH_VERSION != (5.<4->*|<6->.*) ]]; then instant_prompt=off options+=instant_prompt=auto-off return 0 @@ -2008,9 +2008,8 @@ else fi zmodload zsh/terminfo || return -autoload -Uz is-at-least || return -if is-at-least 5.7.1 && [[ $COLORTERM == (24bit|truecolor) ]]; then +if [[ $ZSH_VERSION == (5.7.<1->*|<6->.*) && $COLORTERM == (24bit|truecolor) ]]; then local -ir has_truecolor=1 else local -ir has_truecolor=0