]> git.rmz.io Git - dotfiles.git/commitdiff
zsh: load my functions before sourcing lib
authorSamir Benmendil <me@rmz.io>
Sat, 15 Feb 2020 22:37:09 +0000 (22:37 +0000)
committerSamir Benmendil <me@rmz.io>
Sat, 15 Feb 2020 22:37:09 +0000 (22:37 +0000)
That way they can be used in anything in lib

zshrc

diff --git a/zshrc b/zshrc
index 3174fd68b85671811956a006aa6b6f5cdebbbb5f..127f1e21de9a18c4bb7cc34ded742c0e3f787c51 100644 (file)
--- 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
 
 [[ ! -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
 # 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"
 
 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"
 
 # initialise completion
 autoload -U compinit; compinit -d "$ZSH_CACHE/zcompdump"