summary refs log tree commit diff stats
path: root/hooks/post-up/zsh
blob: 78eb093b8e34cfe7b5d2121dddf969240af69af5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env zsh
ZDOTDIR="${XDG_CONFIG_HOME:~/.config}/zsh"

if [[ ! -d ~/.cache/zsh ]]
then
	mkdir -p ~/.cache/zsh
fi

fasd_cache=~/.cache/zsh/fasd-init-zsh
if [[ ! -s "$fasd_cache" || $ZDOTDIR/functions/fasd/fasd -nt "$fasd_cache" ]]; then
	$ZDOTDIR/functions/fasd/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache"
fi

autoload -U zrecompile
local -a zfiles
zfiles=(
	$ZDOTDIR/functions/fasd/fasd
	$fasd_cache
	$ZDOTDIR/zshrc
)

if [[ -f $ZDOTDIR/${HOST%%.*}.zsh ]]; then
	zfiles+=$ZDOTDIR/${HOST%%.*}.zsh
fi
if [[ $OSTYPE == freebsd* ]]; then
	zfiles+=$ZDOTDIR/freebsd.zsh
fi

zrecompile -p -R $ZDOTDIR/.zshrc.zwc $zfiles -- \
	-M .cache/zsh/compdump

for fp in $ZDOTDIR/functions/*(/); do
	zrecompile -p $fp $fp/*
done