-
Notifications
You must be signed in to change notification settings - Fork 74
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
Do not change fish_user_paths #93
Comments
I can see the reason for wanting to use a universal var. One might want to change the node version across all shells at the same time. At the same time, sometimes you might want different versions in e.g. different tabs. I have not tested this yet, but maybe a middle-ground could be that the conf.d files for fish-nvm checks the user name at shell startup and if it is different then what is found in the |
@thernstig What problem are you having? What's broken? What didn't work? |
@jorgebucaran I was hoping that was clear from my initial post, but obviously I failed to get the point across :) What specific parts did you not understand, as I made several points in there. Or do you want to try to re-phrase the entire question (which I would be happy to do if needed)? |
Does this comment from me and faho's reply explain it better? fish-shell/fish-shell#527 (comment) |
I think I get it now.
Sure, if that works for you, send me a PR. |
@jorgebucaran I see two solutions, but it depends on what you prefer.
For 1) I see a solution of having Do you see drawbacks of such a change? |
That's what I'd expect to happen, so (1) is best for me based on how I use fish-nvm. |
would it be possible to make this configurable somehow? |
@thernstig are you going to be satisfied with my solution #101? An option to use a global path variable instead of universal |
@schrodincat I think it sounds good to support that My problem is moreso that I believe At the same time, I do think that What you are trying to solve can already be solved by https://direnv.net/, which is what I do myself. It is also possibly a better solution as it solves many more things that just the node version. I do not even have to type any |
@thernstig thanks for the hint about |
Here is a quick guide how to get it going: Install node version 12.13.0 with nvm. Put this somewhere in your # Node specific (for direnv to load)
set -gx NODE_VERSIONS ~/.config/nvm
set -gx NODE_VERSION_PREFIX ''
# Always keep at the end of this file
direnv hook fish | source Put a 12.13.0 Put a use node
layout node
watch_file .nvmrc Now if you have another project with node, just repeat the .nvmrc and .envrc steps for that project, if you use node there. With another version if you will. It will automatically load the node env when you move between the project directories. |
I can add the same setup can be done for any language. I do it for e.g. Python, Go etc. etc. When I move between project directories I never have to think about loading the correct versions, it just happens. |
This has already been discussed in #39. Please see my last comment there. I hope @jorgebucaran will include proposed changes into official version, as this feature has been requested multiple times. |
Adding a path in the home directory to the universal var fish_user_paths is not ideal. For example, for my install of fish-nvm it becomes
SETUVAR fish_user_paths:/home/myusername/\x2econfig/nvm/13\x2e0\x2e0/bin
This is problematic due to the reason that some of us version control our home directory and certain parts of it, such as ~/.config/fish/ in order to have a unified working experience over multiple hosts.
Unfortunately there is no way to alter
fish_variables
so that it contains e.g. ~ (so it becomes agnostic as to what ny username is). This is due to that fish expands the path before adding it tofish_variables
to the full path.There are other reasons why setting an explicit user name is not ideal, such as in the case if a user changes his username. This would also invalidated the universal var set by fish-nvm. In short, no paths should be added to universal vars if they are a path in the user directory.
As such, it would be better to add the path to conf.d/nvm.fish as in there one can do
set -gx PATH ~/some/path
and it will be agnostic to the user name. It would also let me use different nodejs versions in different shells opened in fish.The text was updated successfully, but these errors were encountered: