From 591a3bb19d7c8fddbf56ce3d931ff8568e3cb52d Mon Sep 17 00:00:00 2001 From: Fraser Tweedale Date: Sat, 10 Aug 2013 16:31:06 +1000 Subject: [PATCH 1/2] fix MANPATH generation on FreeBSD On FreeBSD, if MANPATH is set it is used verbatim; configuration files are completely ignored. Therefore, setting MANPATH to (only) the nvm man dir makes system man pages unreachable. To get around this, before doing anything else to MANPATH, if it is empty set it to the output of manpath(1). One further complication: FreeBSD automatically adds a path to the man pages path for each path in PATH that ends in "/bin", which causes "~/.nvm/$VERSION/man" to be added. This interferes with the subsequent substitution so strip this from MANPATH before the substitution. --- nvm.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nvm.sh b/nvm.sh index 81920f5..6085dc0 100755 --- a/nvm.sh +++ b/nvm.sh @@ -407,6 +407,10 @@ nvm() { else PATH="$NVM_DIR/$VERSION/bin:$PATH" fi + if [ -z "$MANPATH" ]; then + MANPATH=$(manpath) + fi + MANPATH=${MANPATH#*$NVM_DIR/*/man:} if [[ $MANPATH == *$NVM_DIR/*/share/man* ]]; then MANPATH=${MANPATH%$NVM_DIR/*/share/man*}$NVM_DIR/$VERSION/share/man${MANPATH#*$NVM_DIR/*/share/man} else From 58033251fdef1a360982b7c79a48ff6504d5f9a9 Mon Sep 17 00:00:00 2001 From: Fraser Tweedale Date: Sat, 10 Aug 2013 19:30:25 +1000 Subject: [PATCH 2/2] readme: be inclusive of zsh when discussing shells Much of the discussion in the README pertains to zsh as much as bash, so include a specific reference to ~/.zshrc and remove one explicit reference to bash. --- README.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index eba57e1..135e8e5 100644 --- a/README.markdown +++ b/README.markdown @@ -25,11 +25,11 @@ Or if you have `git` installed, then just clone it: git clone https://github.com/creationix/nvm.git ~/.nvm -To activate nvm, you need to source it from your bash shell +To activate nvm, you need to source it from your shell: source ~/.nvm/nvm.sh -I always add this line to my `~/.bashrc` or `~/.profile` file to have it automatically sourced upon login. +I always add this line to my `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it automatically sourced upon login. Often I also put in a line to use a specific version of node. ## Usage