#!/usr/bin/env zsh ################################################################################ # # This file is autoloaded by .zshrc, and actually loaded when executed # ################################################################################ emulate -L zsh LOGLEVEL=${LOGLEVEL:-7} _SAY_COLORCODE_s6='%F{159}' _SAY_COLORCODE_s7='%F{245}' _SAY_COLORCODE_e6='%f' _SAY_COLORCODE_e7='%f' autoload -Uz say && say say debug "TTY=$TTY" # zcompdump say debug "Checking $ZCACHEDIR/zcompdump" # if zcompdump exists and is non-zero if [[ -s $ZCACHEDIR/zcompdump ]]; then # zcompdump.zwc does not exist/is zero OR zcompdump is newer than zcompdump.zwc if [[ ! $ZCACHEDIR/zcompdump.zwc -nt $ZCACHEDIR/zcompdump ]]; then # use negative prefix so it validates as true if either file does not exist say info "Compiling $ZCACHEDIR/zcompdump" zcompile $ZCACHEDIR/zcompdump fi fi local -aU files funcs tmpfun vcss local g f vcs # zdotfiles say debug "Checking zdotfiles" files=( ~/.zshenv $ZDOTDIR/{.zcalcrc,.zlogin,.zlogout,.zprofile,.zshrc,.zshrc.local}(-.N) ) for f in $files; do if [[ ! $f.zwc -nt $f ]]; then say info "Compiling $f" zcompile -R -- $f fi done # local functions say debug "Checking local functions" files=( $ZDOTDIR/functions/*(-.N) ) for f in $files; do if [[ ! $ZDOTDIR/functions.zwc -nt $f ]]; then say info "Compiling $ZDOTDIR/functions.zwc" zcompile -Uz -- $ZDOTDIR/functions.zwc $files break fi done # local completion-files say debug "Checking local completion-files" files=( $ZDATADIR/completion/*(-.N) ) for f in $files; do if [[ ! $ZDATADIR/completion.zwc -nt $f ]]; then say info "Compiling $ZDATADIR/completion.zwc" zcompile -Uz -- $ZDATADIR/completion.zwc $files break fi done # Misc functions say debug "Doing misc functions" funcs=( colors compinit edit-command-line is-at-least promptinit run-help select-word-style vcs_info zcalc zmv _cp _grep _journalctl _ls _mv _systemctl _vim ) ## include vcs_info-functions funcs+=(${^fpath}/vcs_*(-.N:t) ${^fpath}/VCS_*(-.N:t)) tmpfun=(${(M)funcs:#VCS_INFO_detect_*} ${(M)funcs:#VCS_INFO_get_data_*}) # put all vcs-specific functions in their own array so we can remove the vcss we don't need funcs=(${funcs:|tmpfun}) # remove the vcs-specific ones from $funcs zstyle -g vcss ':vcs_info:*' enable for vcs in $vcss; funcs+=(${(M)tmpfun:#*${vcs}}) say debug "funcs=($funcs)" files=() for f in $funcs; do for g in ${^fpath}/$f(-.N); files+=( $g ) && break done for f in $files; do if [[ ! $ZCACHEDIR/misc_functions.zwc -nt $f ]]; then say info "Compile $ZCACHEDIR/misc_functions.zwc" print -- $files > $ZCACHEDIR/misc_functions.files zcompile -Uz -- $ZCACHEDIR/misc_functions.zwc $files break fi done say info Done # END OF FILE #################################################################