derekstavis / plugin-nvm

Node version manager wrapper for Fish shell
MIT License
233 stars 12 forks source link

Defer initialising nvm until first use #14

Open RasmusWL opened 6 years ago

RasmusWL commented 6 years ago

Starting fish with this plugin is quite slow. Without nvm 0:00.03elapsed, with nvm 0:00.55elapsed.

I have a noticeable delay when staring my program launcher. Would be really great if it was possible to load nvm on first use, instead of when this plugin is loaded.

$ omf remove nvm
nvm successfully removed.

$ time fish -c exit
0.02user 0.00system 0:00.03elapsed 100%CPU (0avgtext+0avgdata 5880maxresident)k
0inputs+0outputs (0major+1064minor)pagefaults 0swap

$ omf install nvm
Updating https://github.com/oh-my-fish/packages-main master... Done!
Installing package nvm
✔ nvm successfully installed

$ time fish -c exit
0.51user 0.08system 0:00.55elapsed 107%CPU (0avgtext+0avgdata 36024maxresident)k
0inputs+8outputs (0major+32142minor)pagefaults 0swaps
FabioAntunes commented 5 years ago

Hey @RasmusWL that was the main reason why I created, https://github.com/FabioAntunes/fish-nvm

It delays sourcing nvm, until you actually need it. The problem in delaying nvm is that the global npm packages installed are not added to the path, so you have to create alias.

Everything is explained on the Readme