Use global ZDOTDIR environment variable#159783
Conversation
0dc581b to
127caac
Compare
d19a85e to
9de6516
Compare
a0941f7 to
d3bdd6f
Compare
Fallback to the users home directory if the variable is not set
d3bdd6f to
66d5c14
Compare
| if [[ -f $USER_ZDOTDIR/.zshenv ]]; then | ||
| VSCODE_ZDOTDIR=$ZDOTDIR | ||
| ZDOTDIR=$USER_ZDOTDIR | ||
|
|
||
| . $USER_ZDOTDIR/.zshenv | ||
|
|
||
| USER_ZDOTDIR=$ZDOTDIR | ||
| ZDOTDIR=$VSCODE_ZDOTDIR | ||
| else | ||
| USER_ZDOTDIR=$HOME | ||
| fi |
There was a problem hiding this comment.
Am I understanding this right in that it fixes the case where $ZDOTDIR (eg. /home/user/myzsh) is set in your profile/login scripts and then have a $ZDOTDIR/.zshenv in that, not in ~/.zshenv?
A comment explaining what's going on here would be good.
There was a problem hiding this comment.
@Tyriar I believe actually what this solves for is when ~/.zshenv is in a $ZDOTDIR which is not equal to ~ as we previously assumed it to be
There was a problem hiding this comment.
which is why the user's ZDOTDIR must be captured before these scripts get run
There was a problem hiding this comment.
So ZDOTDIR gets set in ~/.profile, or somewhere else I'm not thinking of?
There was a problem hiding this comment.
@Tyriar I believe actually what this solves for is when
~/.zshenvis in a$ZDOTDIRwhich is not equal to~as we previously assumed it to be
Exactly
| const userZdotdir = env?.ZDOTDIR ?? os.homedir(); | ||
| envMixin['USER_ZDOTDIR'] = userZdotdir; |
There was a problem hiding this comment.
A comment explaining why this is needed would be good
Fallback to the users home directory if the variable is not set
Related issue: #159785