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

Allow setting nvm's custom install directory #231

Merged
merged 9 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from 8 commits
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
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`

If you want to set a custom directory for storing nvm data:

```fish
set --universal nvm_data $HOME/.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
7 changes: 5 additions & 2 deletions conf.d/nvm.fish
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
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 --universal nvm_data && set --global nvm_data $nvm_data
set --query nvm_data || begin
set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
set --global nvm_data $XDG_DATA_HOME/nvm
end

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