-
Notifications
You must be signed in to change notification settings - Fork 28.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use global ZDOTDIR environment variable #159783
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which is why the user's ZDOTDIR
must be captured before these scripts get run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So ZDOTDIR
gets set in ~/.profile
, or somewhere else I'm not thinking of?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set outside of zsh rc files
#159785 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
Exactly
const userZdotdir = env?.ZDOTDIR ?? os.homedir(); | ||
envMixin['USER_ZDOTDIR'] = userZdotdir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment explaining why this is needed would be good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
Fallback to the users home directory if the variable is not set
Related issue: #159785