Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Sublime Text 3: Apply NVM environment
# Save this file
# mac - "~/Library/Application Support/Sublime Text 3/Packages/"
# linux - "~/.config/sublime-text-3/Packages/"
# ~/.nvm/alias/default must contain full version name.
# $ nvm alias default v4.3.5
import os
home = os.environ['HOME']
with open("%s/.nvm/alias/default" % home) as nvm_default_file:
nvm_default_contents =
path = "%s/.nvm/versions/node/%s/bin" % (home, nvm_default_contents)
path = path + ":" + os.environ['PATH']
os.environ['PATH'] = path

This comment has been minimized.

Copy link

@david-zacharias david-zacharias commented Jul 20, 2018

Thanks for the script. I had to change the script to match node folders on my system:

Additional v as prefix for node version folder in line 14:

path = "%s/.nvm/versions/node/v%s/bin" % (home, nvm_default_contents)

This comment has been minimized.

Copy link

@oslyak oslyak commented Oct 8, 2018

nvm alias default v10.11.0
Then nvm_default_contents will contain v char

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment