рефакторинг(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
# (password prompts, [y/n] confirmations, etc.)
# 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
source "${XDG_CACHE_HOME}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

View File

@@ -1,25 +1,26 @@
# shellcheck shell=bash
# 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
eval "$(starship init zsh)"
return
fi
if is-at-least 5.3; then
zinit ice depth"1" # git clone depth
zinit light romkatv/powerlevel10k
zinit ice depth"1" # git clone depth
zinit light romkatv/powerlevel10k
# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
if [[ -r "$ZDOTDIR/.p10k.user.zsh" ]]; then
source "$ZDOTDIR/.p10k.user.zsh"
else
if [[ "$TERM" = "xterm" ]]; then
[[ -r "$ZDOTDIR/.p10k.8colors.zsh" ]] && source "$ZDOTDIR/.p10k.8colors.zsh"
else
[[ -r "$ZDOTDIR/.p10k.zsh" ]] && source "$ZDOTDIR/.p10k.zsh"
fi
fi
# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
if [[ -r "$ZDOTDIR/.p10k.user.zsh" ]]; then
source "$ZDOTDIR/.p10k.user.zsh"
else
zinit light agkozak/agkozak-zsh-prompt
if [[ "$TERM" = "xterm" ]]; then
[[ -r "$ZDOTDIR/.p10k.8colors.zsh" ]] && source "$ZDOTDIR/.p10k.8colors.zsh"
else
[[ -r "$ZDOTDIR/.p10k.zsh" ]] && source "$ZDOTDIR/.p10k.zsh"
fi
fi