plugin-nvm icon indicating copy to clipboard operation
plugin-nvm copied to clipboard

Defer initialising nvm until first use

Open RasmusWL opened this issue 6 years ago • 1 comments

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

RasmusWL avatar Mar 08 '18 13:03 RasmusWL

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

FabioAntunes avatar Sep 11 '18 16:09 FabioAntunes