Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add nvm script for use by other shells #582

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,19 @@ To use a mirror of the node binaries, set `$NVM_NODEJS_ORG_MIRROR`:

`nvm use` will not, by default, create a "current" symlink. Set `$NVM_SYMLINK_CURRENT` to "true" to enable this behavior, which is sometimes useful for IDEs.

## Other shells

You can run nvm from other shells by using the script provided in the bin
directory. It must remain relative to the install.

Add `<prefix>/bin` and `<prefix>/current/bin` to your PATH and use nvm transparantly.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If using the symlink isn't required, but rather just an extra alternative, then could the symlink instructions be grouped in their own separate section?


### Example [fish-shell](http://fishshell.com/) config:

Where nvm is installed at `~/.nvm`

set -x fish_user_paths $PATH $HOME/.nvm/current/bin $HOME/.nvm/bin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this use $NVM_DIR instead of $HOME/.nvm?


## License

nvm is released under the MIT license.
Expand Down
11 changes: 11 additions & 0 deletions bin/nvm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# For non bash-shells (fish, etc)
# add <prefix>/nvm/bin and <prefix>/nvm/current/bin to PATH
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be part of the install script as well?


export NVM_SYMLINK_CURRENT=true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must this env var be forced to true, for this script to work, rather than just using the environment setting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but the script uses about 90% of it's value without it. Basically you'd be forced to add something to your environmental settings which can just as easily be done here saving the work.


DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source ${DIR}/../nvm.sh;

nvm $@