jorgebucaran / nvm.fish

The Node.js version manager you'll adore, crafted just for Fish
https://git.io/nvm.fish
MIT License
2.06k stars 69 forks source link

feat: auto invoke nvm use on PWD change #181

Closed edouard-lopez closed 1 year ago

edouard-lopez commented 2 years ago

Hello @jorgebucaran, long time no see :)

As I was not satisfied by the Deeper Shell Integration for Fish solution from _classic NVM, I sought something simpler.

I added a mechanism to automatically invoke nvm use on PWD changes based on @ygormutti's idea https://github.com/wbyoung/avn/issues/12#issuecomment-403942224.

Current version is pretty dumb, but wanted to check if that was of interest to you first. So please let me know if you want such feature? Feature behind a flag:

set --universal auto_invoke_nvm true
jorgebucaran commented 2 years ago

Hi, @edouard-lopez! Perhaps this should be a plug-in? Definitely not the default behavior.

edouard-lopez commented 2 years ago

Can you elaborate on the plugin idea? Do you mean with feature flag, a dedicated repo, or something else?

jorgebucaran commented 2 years ago

For starters this function could be a different plugin, installed separately. Or as you say, behind a feature flag (universal variable).

edouard-lopez commented 2 years ago

update with feature flag

jorgebucaran commented 2 years ago

Good work, @edouard-lopez. Left you one suggestion. 👋

bastianwegge commented 1 year ago

Just pinging, we just ran into the same scenario, used your code and it works flawlessly. Is there any chance for this to make it to master/release? :)

jorgebucaran commented 1 year ago

I left some comments that weren't resolved. I also don't want to bloat this tool with features, hence the long silence.

edouard-lopez commented 1 year ago

I haven't the need for this currently, so won't push forward, @bastianwegge feel free to push on my MR or fork it.

You might be interested in volta.

lydell commented 1 year ago

In case someone else comes across this PR and wants this functionality, here’s a way to do it in userland:

https://github.com/jorgebucaran/nvm.fish/pull/186#issuecomment-1142412874

jorgebucaran commented 1 year ago

Took another peek while fixing bugs and closing old issues. This one's a bit of a tricky issue, as it adds a lot of complication to nvm.fish for everyone. Personally, I don't have a need for it, but I get that some folks do. That's why we worked on #186 to improve switch times and encourage folks to come up with their own tiny functions (remember how cool it is to extend your Fish shell?), like @lydell did. 💯