Skip to content

Commit

Permalink
Allow setting nvm's custom install directory (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
davychhouk authored Feb 7, 2025
1 parent a0892d0 commit 62f3ac1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ Got a list of default packages you want installed every time you install a new N
set --universal nvm_default_packages yarn np
```

## `$nvm_data`

Set where nvm stores Node binaries and related data. Defaults to `$XDG_DATA_HOME/nvm` (~/.local/share/nvm) if unset.

```fish
set --global nvm_data ~/.nvm
```

## Acknowledgments

`nvm.fish` was established in 2016 by [**@jorgebucaran**](https://github.com/jorgebucaran) as the go-to Node.js version manager for Fish. It was inspired by the original [**nvm.sh**](https://github.com/nvm-sh/nvm) created by [**@creationix**](https://github.com/creationix) and [**@ljharb**](https://github.com/ljharb). To use the original nvm in Fish, consider [**@FabioAntunes/fish-nvm**](https://github.com/FabioAntunes/fish-nvm) or [**@derekstavis/plugin-nvm**](https://github.com/derekstavis/plugin-nvm). We appreciate all of our contributors! ❤️
Expand Down
4 changes: 2 additions & 2 deletions conf.d/nvm.fish
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist
set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
set --global nvm_data $XDG_DATA_HOME/nvm
set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist
set --query nvm_data || set --global nvm_data $XDG_DATA_HOME/nvm

function _nvm_install --on-event nvm_install
test ! -d $nvm_data && command mkdir -p $nvm_data
Expand Down
1 change: 1 addition & 0 deletions functions/nvm.fish
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function nvm --description "Node version manager"
echo " nvm_mirror Use a mirror for downloading Node binaries"
echo " nvm_default_version Set the default version for new shells"
echo " nvm_default_packages Install a list of packages every time a Node version is installed"
echo " nvm_data Set a custom directory for storing nvm data"
echo "Examples:"
echo " nvm install latest Install the latest version of Node"
echo " nvm use 14.15.1 Use Node version 14.15.1"
Expand Down

0 comments on commit 62f3ac1

Please sign in to comment.