Skip to content
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

pearl init does not respect zsh environment variables #110

Open
Snogard opened this issue Oct 29, 2022 · 3 comments
Open

pearl init does not respect zsh environment variables #110

Snogard opened this issue Oct 29, 2022 · 3 comments

Comments

@Snogard
Copy link

Snogard commented Oct 29, 2022

What is the problem?

pearl init writes its changes to the $HOME/.zshrc file regardless of environment variables. this casues a creation of a new one-lined .zshrc file in my home dir that will never be used

Suggested fix

if not empty use $ZDOTDIR to determine where is the user's .zshrc
eg: $ZDOTDIR/.zshrc

MIght be worth to check other envs as well for bash, vim ecc...

@fsquillace
Copy link
Member

fsquillace commented Oct 29, 2022

The purpose of pearl init is exactly to init any programs that can be connected to pearl regardless about which shell the user is using.

Anyway a better experience will be achieved once we get a lazy init approach: #112

Closing in favor of that.

@Snogard
Copy link
Author

Snogard commented Oct 29, 2022

i think you missed the point on this issue. the problem is that there is a .zshrc file but it's not in the location pearl thinks.
for example, normally a .zshrc is in $HOME/.zshrc (/home/user/.zshrc), but if i set $ZDOTDIR, then the .zshrc could be in a different folder. In my system i have $ZDOTDIR set as /home/user/.local/share/zsh so zsh will load this /home/user/.local/share/zsh/.zshrc instead of this home/user/.zshrc. As far as i know pearl init is ignoring this zsh configuration causing it to init to the wrong file.
For now i'm manually copying the generated line to the correct file.

@fsquillace
Copy link
Member

I see what you meant now. Rather than copying I'd suggest to simply place a source ~/.zshrc instead.

Although it seems a simple issue it may be actually a tricky problem to solve (pearl init should occur every time the ZDOTDIR is changing). By allowing to dinamically change the config location it makes hard to init pearl into the right configuration. I'd not expect to solve this because is an edge case that most of the people should not encounter (so definitely low priority issue) and has simple workaround (namely, just using a source).

Reopening the issue just in case we can address it in the future.

@fsquillace fsquillace reopened this Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants