Most people seem to recommend using source for reloading .zshrc. Why?
First I tried out source ~/.zshrc. But it resulted in a compinit error (at reload, not for new shell instances at first .zshrc load).
My reload alias is now:
alias zsh-reload="exec zsh"
instead of:
source ~/.zshrc
The reason for this is that my previous reload method (source) triggered a compinit error;
zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?
So I'm now doing exec because I believie it ensures the previous environment doesn't pollute the new one.
- What are the downsides of using the
execmethod? - Is there an explicit reason for that you're doing
execorsource? - Could
execin theory cause unexpected problems compared to thesourcemethod?
With
exec, all (unexported) variables in your shell are lost, which is probably not what you want. Instead, it might be better to fix the compinit problem, by usingcompinit -i. See the zsh man page for compinit, paragraph Use of compinit: