4
I working on source controlling my dotfiles and a lof of what I'm doing is based off of Zach Holman's dotfiles. I want to source all zsh files like he does in his files but before I just throw the code in there I want to actually understand what the code is doing. The snippet I'm confused with is
# all of our zsh files
typeset -U config_files
config_files=($ZSH/**/*.zsh)
# load the path files
for file in ${(M)config_files:#*/path.zsh}
do
source $file
done
# load everything but the path and completion files
for file in ${${config_files:#*/path.zsh}:#*/completion.zsh}
do
source $file
done
# initialize autocomplete here, otherwise functions won't be loaded
autoload -U compinit
compinit
# load every completion after autocomplete loads
for file in ${(M)config_files:#*/completion.zsh}
do
source $file
done
unset config_files
Mostly I'm confused as to what is happening here
${(M)config_files:#*/path.zsh}
and here
${${config_files:#*/path.zsh}:#*/completion.zsh}
So what does this all mean?