рефакторинг(zsh): улучшить стабильность Zsh при запуске

*   Добавлены проверки минимальной версии Zsh для повышения надежности
*   Оптимизирована логика загрузки Powerlevel10k
*   Внедрена быстрая проверка Starship
This commit is contained in:
2026-04-11 14:32:49 +03:00
parent ef8685b3bb
commit 8b06929bc2
2 changed files with 19 additions and 14 deletions

View File

@@ -6,6 +6,10 @@
# Initialization code that may require console input # Initialization code that may require console input
# (password prompts, [y/n] confirmations, etc.) # (password prompts, [y/n] confirmations, etc.)
# must go above this block; everything else may go below. # must go above this block; everything else may go below.
! is-at-least 5.8 && return
command -v starship >/dev/null && return
if [ -r "${XDG_CACHE_HOME}/p10k-instant-prompt-${(%):-%n}.zsh" ]; then if [ -r "${XDG_CACHE_HOME}/p10k-instant-prompt-${(%):-%n}.zsh" ]; then
source "${XDG_CACHE_HOME}/p10k-instant-prompt-${(%):-%n}.zsh" source "${XDG_CACHE_HOME}/p10k-instant-prompt-${(%):-%n}.zsh"
fi fi

View File

@@ -1,12 +1,16 @@
# shellcheck shell=bash # shellcheck shell=bash
# vim: ft=sh # vim: ft=sh
if ! is-at-least 5.8; then
zinit light agkozak/agkozak-zsh-prompt
return
fi
if command -v starship >/dev/null; then if command -v starship >/dev/null; then
eval "$(starship init zsh)" eval "$(starship init zsh)"
return return
fi fi
if is-at-least 5.3; then
zinit ice depth"1" # git clone depth zinit ice depth"1" # git clone depth
zinit light romkatv/powerlevel10k zinit light romkatv/powerlevel10k
@@ -20,6 +24,3 @@ if is-at-least 5.3; then
[[ -r "$ZDOTDIR/.p10k.zsh" ]] && source "$ZDOTDIR/.p10k.zsh" [[ -r "$ZDOTDIR/.p10k.zsh" ]] && source "$ZDOTDIR/.p10k.zsh"
fi fi
fi fi
else
zinit light agkozak/agkozak-zsh-prompt
fi