FabioAntunes / fish-nvm

nvm wrapper for fish-shell
MIT License
509 stars 20 forks source link

It won't load nvm automatically, only if I trigger the function __nvm_run #2

Closed mr-pinzhang closed 8 years ago

mr-pinzhang commented 8 years ago

I believe that loading nvm.sh after intialization would be better, otherwise It won't inject or modify necessary ENV VARIABLES into global, like $PATH, where stores some global dependencies installed by NPM. Only I can access the bin after type node or nvm, it's annoying, right?

mr-pinzhang commented 8 years ago

And I figured out one solution, is that add bass source $NVM_DIR/nvm.sh to config.fish

FabioAntunes commented 8 years ago

That's the point, sourcing nvm everytime you open a new terminal will slow it down by a couple of seconds, this plugins only sources nvm when you run nvm, npm or node if you want it to be runnig whenever you open the terminal just add this to your config.fish

if not type -q bass
    echo 'Bass is not installed please install it running fisher edc/bass'
else
   bass source $NVM_DIR/nvm.sh >/dev/null ^&1
end
mr-pinzhang commented 8 years ago

yep.. I noticed that before.. actually, it's much slower is that caused by bass process? anyway, thanks the code!

FabioAntunes commented 8 years ago

The biggest problem is in nvm itself, more info in https://github.com/creationix/nvm/issues/860 and https://github.com/creationix/nvm/issues/703

Of course sourcing bash code in fish adds a couple of milliseconds

ghost commented 8 years ago

@bjmin If you are not constrained to using nvm (e.g, company rule, etc), I recommend you https://github.com/fisherman/fin.

mr-pinzhang commented 8 years ago

@bucaran thx~.. though i'm looking for a more native way to install Node, i'll give a try!

ghost commented 8 years ago

@bjmin I could be completely wrong, and please @FabioAntunes correct me if I am wrong, but I see little benefit to building from source unless you actually want to fiddle with the source code, in which case, sure go ahead :)