Чище код загрузки модулей

This commit is contained in:
2026-04-11 12:08:37 +03:00
parent 6ffce04ff3
commit 3f74fb6dc5

49
.zshrc
View File

@@ -7,28 +7,35 @@
mkdir -p "$ZDOTDIR/net.d" mkdir -p "$ZDOTDIR/net.d"
find "$ZDOTDIR/net.d" -name "*.zsh" -print0 | sort -z | while IFS= read -r -d $'\0' net; do source "$net"; done find "$ZDOTDIR/net.d" -name "*.zsh" -print0 | sort -z | while IFS= read -r -d $'\0' net; do source "$net"; done
for S in \ stages=(
05-start \ 05-start
15-options \ 15-options
25-history \ 25-history
42-zinit \ 42-zinit
45-plugins \ 45-plugins
55-agents \ 55-agents
62-scripts \ 62-scripts
65-vpy \ 65-vpy
68-aliases \ 68-aliases
72-widgets \ 72-widgets
78-keybindings \ 78-keybindings
82-completion \ 82-completion
88-prompt \ 88-prompt
95-finish; do 95-finish
N="${S//[0-9\-]/}" )
if [[ -r "$ZDOTDIR/$S.pre.zsh" ]]; then source "$ZDOTDIR/$S.pre.zsh"; fi
if [[ -r "$ZDOTDIR/$S.zsh" ]]; then source "$ZDOTDIR/$S.zsh"; fi # Итерация по этапам
if [[ -r "$ZDOTDIR/$S.user.zsh" ]]; then source "$ZDOTDIR/$S.user.zsh"; fi for S in "${stages[@]}"; do
if [[ -r "$ZDOTDIR/$N.user.zsh" ]]; then source "$ZDOTDIR/$N.user.zsh"; fi # Zsh-подстановка (удаление цифр и дефиса в начале)
if [[ -r "$ZDOTDIR/$S.post.zsh" ]]; then source "$ZDOTDIR/$S.post.zsh"; fi N=${S##[0-9]#-}
# Проход по файлам в строгом порядке их загрузки
for F in "$ZDOTDIR/$S.pre.zsh" "$ZDOTDIR/$S.zsh" "$ZDOTDIR/$S.user.zsh" "$ZDOTDIR/$N.user.zsh" "$ZDOTDIR/$S.post.zsh"; do
[[ -r "$F" ]] && source "$F"
done done
done
unset stages S N F
mkdir -p "$ZDOTDIR/apps.d" mkdir -p "$ZDOTDIR/apps.d"
find "$ZDOTDIR/apps.d" -name "*.zsh" -print0 | sort -z | while IFS= read -r -d $'\0' app; do source "$app"; done find "$ZDOTDIR/apps.d" -name "*.zsh" -print0 | sort -z | while IFS= read -r -d $'\0' app; do source "$app"; done