2023-12-23 09:15:33 +03:00
|
|
|
#!/bin/zsh
|
|
|
|
|
|
|
|
typeset -gA ZSHU
|
|
|
|
|
|
|
|
ZSHU[t_begin]=${(%):-%D{%s.%6.}}
|
|
|
|
|
|
|
|
ZSHU[d_zdot]="${ZDOTDIR}"
|
2024-02-28 23:22:33 +03:00
|
|
|
ZSHU[d_dotfiles]="${ZDOTDIR}/.config/dotfiles"
|
2023-12-23 09:15:33 +03:00
|
|
|
ZSHU[d_conf]="${ZDOTDIR}/.config/zsh"
|
2024-02-28 23:22:33 +03:00
|
|
|
ZSHU[d_cache]="${ZDOTDIR}/.cache/zsh"
|
2023-12-23 09:15:33 +03:00
|
|
|
|
|
|
|
ZSHU[d_var]="${ZSHU[d_conf]}/var"
|
2024-02-28 23:22:33 +03:00
|
|
|
ZSHU[d_bin]="${ZSHU[d_dotfiles]}/bin"
|
|
|
|
ZSHU[d_scripts]="${ZSHU[d_dotfiles]}/scripts"
|
2023-12-23 09:15:33 +03:00
|
|
|
|
|
|
|
## early escape
|
2024-01-16 02:55:39 +03:00
|
|
|
unsetopt global_rcs
|
2023-12-23 09:15:33 +03:00
|
|
|
|
|
|
|
## safety measure:
|
|
|
|
## redirect all following activity within ZDOTDIR to cache
|
2024-02-28 23:22:33 +03:00
|
|
|
export ZDOTDIR="${ZSHU[d_cache]}/dots"
|
2023-12-23 09:15:33 +03:00
|
|
|
|
|
|
|
## cleanup: start from scratch
|
|
|
|
for i ( a s f d ) ; do unhash -$i -m '*' ; done ; unset i
|
|
|
|
|
|
|
|
## set default umask
|
|
|
|
umask 0022
|
|
|
|
|
|
|
|
zshu_parts=( env opt lib rc alias local )
|
|
|
|
|
2024-01-27 00:10:58 +03:00
|
|
|
for n ( ${zshu_parts} ) ; do
|
2024-02-28 23:22:33 +03:00
|
|
|
[ -s "${ZSHU[d_conf]}/$n.zsh" ] || continue
|
|
|
|
source "${ZSHU[d_conf]}/$n.zsh"
|
|
|
|
done ; unset n
|
2023-12-23 09:15:33 +03:00
|
|
|
|
2024-01-27 00:10:58 +03:00
|
|
|
for n ( ${zshu_parts} ) ; do
|
2024-02-28 23:22:33 +03:00
|
|
|
[ -d "${ZSHU[d_conf]}/$n" ] || continue
|
|
|
|
for i ( "${ZSHU[d_conf]}/$n"/*.zsh(N.r) ) ; do
|
2023-12-23 09:15:33 +03:00
|
|
|
source "$i"
|
2024-02-23 21:46:04 +03:00
|
|
|
done
|
2024-02-28 23:22:33 +03:00
|
|
|
done ; unset i n
|
2023-12-23 09:15:33 +03:00
|
|
|
|
|
|
|
unset zshu_parts
|
|
|
|
|
2024-02-28 23:22:33 +03:00
|
|
|
hash -f
|
2023-12-23 09:15:33 +03:00
|
|
|
|
2024-02-28 23:22:33 +03:00
|
|
|
t=${(%):-%D{%s.%6.}}
|
|
|
|
t=$[ t - ZSHU[t_begin] ]
|
|
|
|
unset 'ZSHU[t_begin]'
|
|
|
|
n=${t#*.}
|
|
|
|
ZSHU[t_load]=${t%.*}.${n:0:4}
|
|
|
|
unset n t
|