summaryrefslogtreecommitdiff
path: root/hooks/post-update
blob: c5bd57f0de9b03f4f573347b599d88bf83e74cd4 (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
# vim:ft=zsh
## This is a post-update hook for caretaker (a vcs-home implementation).
## It includes configs provided by other packages
## and sets some more static parameters
mkdir -p $HOME/var/cache/zsh
mkdir -p $PKG_DIR/zsh/provided
rm -f $HOME/var/cache/zsh/compdump
echo -n > $PKG_DIR/zsh/provided/includes
echo -n > $PKG_DIR/zsh/provided/env

typeset -a futurepath
for inc in $PKG_DIR/*/provides/zsh/{functions,completions}(N); {
	futurepath+=${inc/$HOME/\$HOME}
}
if [[ -n $futurepath ]] {
	echo "fpath=($futurepath \$fpath)" > $PKG_DIR/zsh/provided/env
}
for inc in $PKG_DIR/*/provides/zsh/functions(*N:t); {
	echo "autoload $inc" >> $PKG_DIR/zsh/provided/includes
}

for snippet in $PKG_DIR/*/provides/zsh/*(.N); {
	echo "source ${snippet/$HOME/\$HOME}" >> $PKG_DIR/zsh/provided/includes
}

cd $PKG_DIR/zsh/etc
zcompile functions.zwc functions/*
zcompile completions.zwc completions/*

# Preserve old history
if [[ -e ~/.histfile && ! -e ~/var/cache/zsh/history ]] {
	cp ~/.histfile ~/var/cache/zsh/history
}