From: Samir Benmendil Date: Sat, 15 Feb 2020 22:37:09 +0000 (+0000) Subject: zsh: load my functions before sourcing lib X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/414d40e0d79ec358c0e440388cb00cfdd36e9330?ds=inline zsh: load my functions before sourcing lib That way they can be used in anything in lib --- diff --git a/zshrc b/zshrc index 3174fd6..127f1e2 100644 --- a/zshrc +++ b/zshrc @@ -6,6 +6,11 @@ ZSH_CACHE=$XDG_CACHE_HOME/zsh [[ ! -d "$ZSH_CACHE" ]] && echo "Missing cache dir: '$ZSH_CACHE'" && return [[ ! -d "$ZSH_DATA" ]] && echo "Missing data dir: '$ZSH_DATA'" && return +# load my functions +typeset -U fpath # make fpath a unique array +[[ -d $ZSH/functions ]] && fpath=($ZSH/functions $fpath) +autoload -U ${fpath[1]}/*(:t) # loads all functions in the first element of fpath + # Load all of the config files in $ZSH/lib that end in .zsh for config_file ($ZSH/lib/*.zsh); do source $config_file @@ -16,11 +21,6 @@ done ZSH_THEME="ramsi" [[ -f "$ZSH/themes/${ZSH_THEME}.zsh-theme" ]] && source "$ZSH/themes/${ZSH_THEME}.zsh-theme" -# load my functions -typeset -U fpath # make fpath a unique array -[[ -d $ZSH/functions ]] && fpath=($ZSH/functions $fpath) -autoload -U ${fpath[1]}/*(:t) # loads all functions in the first element of fpath - # initialise completion autoload -U compinit; compinit -d "$ZSH_CACHE/zcompdump"