1
0
dotfiles/.config/zsh/_.zsh

56 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/zsh
: "${ZDOTDIR:=${HOME}}"
typeset -gA ZSHU
ZSHU[t_begin]=${(%):-%D{%s.%6.}}
ZSHU[d_zdot]="${ZDOTDIR}"
ZSHU[d_cache]="${ZDOTDIR}/.cache/zsh"
ZSHU[d_conf]="${ZDOTDIR}/.config/zsh"
ZSHU[d_var]="${ZSHU[d_conf]}/var"
2024-01-27 00:10:58 +03:00
ZSHU[d_bin]="${ZDOTDIR}/.config/dotfiles/bin"
ZSHU[d_scripts]="${ZDOTDIR}/.config/dotfiles/scripts"
## early escape
2024-01-16 02:55:39 +03:00
unsetopt global_rcs
## safety measure:
## redirect all following activity within ZDOTDIR to cache
## (probably) these files are safe to remove
ZDOTDIR="${ZSHU[d_cache]}"
rm -f "${ZDOTDIR}/.zshrc" "${ZDOTDIR}/.zlogin"
## 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
f="${ZSHU[d_conf]}/$n.zsh"
[ -s "$f" ] && source "$f"
done ; unset n f
2024-01-27 00:10:58 +03:00
for n ( ${zshu_parts} ) ; do
d="${ZSHU[d_conf]}/$n"
[ -d "$d" ] || continue
2024-02-23 21:46:04 +03:00
for i ( "$d"/*.zsh(N.r) ) ; do
source "$i"
2024-02-23 21:46:04 +03:00
done
done ; unset i n d
unset zshu_parts
ZSHU[t_end]=${(%):-%D{%s.%6.}}
2024-01-27 00:10:58 +03:00
ZSHU[t_load]=$[ ZSHU[t_end] - ZSHU[t_begin] ]
ZSHU[t_load]=${ZSHU[t_load]:0:6}
2024-01-16 02:55:39 +03:00
unset 'ZSHU[t_begin]' 'ZSHU[t_end]'