diff options
author | Alan Pearce | 2014-04-12 18:17:23 +0100 |
---|---|---|
committer | Alan Pearce | 2014-04-12 18:17:23 +0100 |
commit | 65f9082920ad3d3d92929d68a125986a8c70cd0b (patch) | |
tree | 15b4be2190b44fee7a86c106efcbe11084f4a305 /hooks/post-up/zsh | |
parent | 81c8016d1e296ed91af69f2d5bf435d7d657af04 (diff) | |
download | nixfiles-65f9082920ad3d3d92929d68a125986a8c70cd0b.tar.lz nixfiles-65f9082920ad3d3d92929d68a125986a8c70cd0b.tar.zst nixfiles-65f9082920ad3d3d92929d68a125986a8c70cd0b.zip |
Move install functionality to rcm hooks
Diffstat (limited to 'hooks/post-up/zsh')
-rwxr-xr-x | hooks/post-up/zsh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh new file mode 100755 index 00000000..f964e2bd --- /dev/null +++ b/hooks/post-up/zsh @@ -0,0 +1,34 @@ +#!/usr/bin/env zsh +ZDOTDIR="${XDG_CONFIG_HOME:~/.config}/zsh" + +if [[ ! -d ~/.zsh/cache ]] +then + mkdir -p ~/.zsh/cache +fi + +fasd_cache=~/.zsh/cache/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 .zsh/cache/compdump + +for fp in $ZDOTDIR/functions/*(/); do + zrecompile -p $fp $fp/* +done |