2016-07-09 04:21:04 +08:00
# zsh-nvm
> Zsh plugin for installing, updating and loading `nvm`
[`nvm` ](https://github.com/creationix/nvm ) is an awesome tool but it can be kind of a pain to install and keep up to date. This zsh plugin allows you to quickly setup `nvm` once, save it in your dotfiles, then never worry about it again.
2016-07-25 03:38:36 +08:00
The plugin will install the latest stable release of `nvm` if you don't already have it, and then automatically `source` it for you. You can upgrade `nvm` to the latest version whenever you want without losing your installed `node` versions by running `nvm upgrade` .
2016-07-09 04:21:04 +08:00
2016-07-13 20:33:30 +08:00
Although this is written as a zsh plugin, it also works with bash if you follow the [manual installation instructions ](#manually ).
2016-07-09 04:21:04 +08:00
## Usage
2016-07-25 03:35:52 +08:00
Once the plugin's installed `nvm` will be available. You'll probably want to load this as one of your first plugins so `node` /`npm` is available for any other plugins that may require them.
2016-07-09 04:21:04 +08:00
2016-07-27 06:41:54 +08:00
`zsh-nvm` also wraps `nvm` in some additional functionality.
### Upgrade
If you want to upgrade to the latest release of `nvm` :
2016-07-09 04:21:04 +08:00
```shell
2016-07-25 03:38:36 +08:00
% nvm upgrade
2016-07-27 06:41:54 +08:00
Installed version is v0.31.0
2016-07-09 04:21:04 +08:00
Checking latest version of nvm...
2016-07-27 06:41:54 +08:00
Updating to v0.31.3...
Previous HEAD position was 2176894... v0.31.0
HEAD is now at 56417f8... v0.31.3
```
### Revert
If an upgrade breaks something don't worry, reverting back to the previously installed version is simple:
```shell
% nvm revert
Installed version is v0.31.3
Reverting to v0.31.0...
Previous HEAD position was 56417f8... v0.31.3
HEAD is now at 2176894... v0.31.0
2016-07-09 04:21:04 +08:00
```
## Installation
### Using [Antigen](https://github.com/zsh-users/antigen)
Bundle `zsh-nvm` in your `.zshrc`
```shell
antigen bundle lukechilds/zsh-nvm
```
### Using [zplug](https://github.com/b4b4r07/zplug)
Load `zsh-nvm` as a plugin in your `.zshrc`
```shell
zplug "lukechilds/zsh-nvm"
```
### Using [zgen](https://github.com/tarjoilija/zgen)
Include the load command in your `.zshrc`
```shell
zgen load lukechilds/zsh-nvm
```
### As an [Oh My ZSH!](https://github.com/robbyrussell/oh-my-zsh) custom plugin
Clone `zsh-nvm` into your custom plugins repo
```shell
git clone https://github.com/lukechilds/zsh-nvm ~/.oh-my-zsh/custom/plugins/zsh-nvm
```
Then load as a plugin in your `.zshrc`
```shell
plugins+=(zsh-nvm)
```
### Manually
2016-07-09 05:58:27 +08:00
Clone this repository somewhere (`~/.zsh-nvm` for example)
2016-07-09 04:21:04 +08:00
```shell
2016-07-09 05:59:57 +08:00
git clone https://github.com/lukechilds/zsh-nvm.git ~/.zsh-nvm
2016-07-09 04:21:04 +08:00
```
2016-07-13 20:33:30 +08:00
Then source it in your `.zshrc` (or `.bashrc` )
2016-07-09 04:21:04 +08:00
```shell
2016-07-09 05:58:27 +08:00
source ~/.zsh-nvm/zsh-nvm.plugin.zsh
2016-07-09 04:21:04 +08:00
```
2016-07-09 16:35:59 +08:00
## Related
- [`zsh-better-npm-completion` ](https://github.com/lukechilds/zsh-better-npm-completion ) - Better completion for `npm`
2016-07-09 04:21:04 +08:00
## License
MIT © Luke Childs