From 452fbd5162cf41760c814f24bb79de5b14f21d99 Mon Sep 17 00:00:00 2001 From: Daniel Bretoi Date: Fri, 21 Nov 2014 13:11:49 -0800 Subject: [PATCH 1/2] add nvm script for use by other shells --- README.markdown | 13 +++++++++++++ bin/nvm | 11 +++++++++++ 2 files changed, 24 insertions(+) create mode 100755 bin/nvm diff --git a/README.markdown b/README.markdown index bdf9007..669be3b 100644 --- a/README.markdown +++ b/README.markdown @@ -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 `/bin` and `/current/bin` to your PATH and use nvm transparantly. + +### 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 + ## License nvm is released under the MIT license. diff --git a/bin/nvm b/bin/nvm new file mode 100755 index 0000000..33b0465 --- /dev/null +++ b/bin/nvm @@ -0,0 +1,11 @@ +#!/bin/bash + +# For non bash-shells (fish, etc) +# add /nvm/bin and /nvm/current/bin to PATH + +export NVM_SYMLINK_CURRENT=true + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source ${DIR}/../nvm.sh; + +nvm $@ From 4be76df03d765115ae020808010704fc866bcac1 Mon Sep 17 00:00:00 2001 From: Daniel Bretoi Date: Fri, 21 Nov 2014 13:42:38 -0800 Subject: [PATCH 2/2] change $HOME to $NVM_DIR in readme. Remove unncessary comments in script --- README.markdown | 2 +- bin/nvm | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/README.markdown b/README.markdown index 669be3b..71f98f3 100644 --- a/README.markdown +++ b/README.markdown @@ -109,7 +109,7 @@ Add `/bin` and `/current/bin` to your PATH and use nvm transpara Where nvm is installed at `~/.nvm` - set -x fish_user_paths $PATH $HOME/.nvm/current/bin $HOME/.nvm/bin + set -x fish_user_paths $PATH $NVM_DIR/current/bin $NVM_DIR/bin ## License diff --git a/bin/nvm b/bin/nvm index 33b0465..85d4785 100755 --- a/bin/nvm +++ b/bin/nvm @@ -1,8 +1,5 @@ #!/bin/bash -# For non bash-shells (fish, etc) -# add /nvm/bin and /nvm/current/bin to PATH - export NVM_SYMLINK_CURRENT=true DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"