.zshenv vs. .zshrc
Relevant excerpt from zshโs manpage:
Commands are first read from
/etc/zshenv[โฆ] Commands are then read from$ZDOTDIR/.zshenv. If the shell is a login shell, commands are read from/etc/zprofileand then$ZDOTDIR/.zprofile. Then, if the shell is interactive, commands are read from/etc/zshrcand then$ZDOTDIR/.zshrc.
Finally, if the shell is a login shell, /etc/zlogin and $ZDOTDIR/.zlogin are read.
In a nutshell:
.zshenv
Use this for environment variables and settings needed by all processes (PATH, EDITOR, etc.)
[!NOTE] A lot of install tools get this wrong and will append to
$PATHin.zshrc, which works fine for CLI usage, but might cause confusion when trying to run it from another process.
.zshrc
Use this for interactive shell customizations (aliases, functions, prompt, completions).