zshi icon indicating copy to clipboard operation
zshi copied to clipboard

Ensure global startup RCs see the right ZDOTDIR

Open strugee opened this issue 1 year ago • 8 comments

We do this by disabling zsh's builtin behavior to read these startup files and instead doing them ourselves. This allow us to exert control over what ZDOTDIR is set to (we cannot just set ZDOTDIR to the right thing before global startup scripts are executed because this would cause zsh to not execute the custom startup scripts we wrote out to the temporary directory).

In order to maintain compatibility with existing zsh behavior, we stash the state of the GLOBAL_RCS option at the end of our custom startup scripts but before disabling the option. We then restore its state at the beginning of the next startup script (so immediately after zsh would have executed the relevant global startup script).

Note that I didn't test this exhaustively (I basically just tested that the behavior described in #3 was fixed).

Fixes #3

strugee avatar Aug 05 '22 23:08 strugee