I have a line in my .zshrc file, source $SNIPPETS/*.zsh
and I know it's partially working because some functions defined in the directory work, but others do not unless I specifically source the file exclusively.
What steps would I take to find where in the sourcing there is an early exit or break?
CodePudding user response:
You can only source
one file at a time. The first file is being sourced, but not the rest.
You'll need to use a loop in .zshrc
for i in "$SNIPPETS"/*.zsh; do
[[ -e "$i" ]] && source "$i"
done
CodePudding user response:
TODAY I LEARNED: that source
only works on explicitly called files. One can input multiple files but no wild cards.
None of my files were breaking.
Steps I took for debugging:
- Started a new shell.
- Enabled
zprof
. (zmodload zsh/zprof
) - Ran the source line.
source $SNIPPETS/*.zsh
- Realized that only one file was being sourced.
- Re scoped my search for 'zsh source wildcard`
- Found and implemented option one from this answer (https://stackoverflow.com/a/14680403/5724147).