summaryrefslogtreecommitdiff
path: root/plugins/nvm
diff options
context:
space:
mode:
authorMarc CornellĂ  <marc.cornella@live.com>2019-10-24 17:57:01 +0200
committerGitHub <noreply@github.com>2019-10-24 17:57:01 +0200
commitcad48e38bfbfa6e3e0096caddf330d6fc8f1ffb9 (patch)
tree2b07ec259bbd2b1a4919245669900a87fa87a03b /plugins/nvm
parent225425fe091ca052997833279ccc08643818c24a (diff)
parent40df67bc3b9b51caa24df5d220487043040d1f9a (diff)
downloadzsh-cad48e38bfbfa6e3e0096caddf330d6fc8f1ffb9.tar.gz
zsh-cad48e38bfbfa6e3e0096caddf330d6fc8f1ffb9.tar.bz2
zsh-cad48e38bfbfa6e3e0096caddf330d6fc8f1ffb9.zip
Merge branch 'master' into fabric_task_description
Diffstat (limited to 'plugins/nvm')
-rw-r--r--plugins/nvm/README.md9
-rw-r--r--plugins/nvm/_nvm19
-rw-r--r--plugins/nvm/nvm.plugin.zsh7
3 files changed, 27 insertions, 8 deletions
diff --git a/plugins/nvm/README.md b/plugins/nvm/README.md
new file mode 100644
index 000000000..079cf0009
--- /dev/null
+++ b/plugins/nvm/README.md
@@ -0,0 +1,9 @@
+# nvm plugin
+
+This plugin adds autocompletions for [nvm](https://github.com/creationix/nvm) — a Node.js version manager.
+It also automatically sources nvm, so you don't need to do it manually in your `.zshrc`.
+
+To use it, add `nvm` to the plugins array of your zshrc file:
+```zsh
+plugins=(... nvm)
+```
diff --git a/plugins/nvm/_nvm b/plugins/nvm/_nvm
index 1414dcbb1..1eec48b0a 100644
--- a/plugins/nvm/_nvm
+++ b/plugins/nvm/_nvm
@@ -6,16 +6,23 @@
local -a _1st_arguments
_1st_arguments=(
'help:show help'
- 'install:download and install a version'
+ '--version:print out the latest released version of nvm'
+ 'install:download and install a version in <node|iojs|node version number>'
'uninstall:uninstall a version'
- 'use:modify PATH to use version'
- 'run:run version with given arguments'
+ 'use:modify PATH to use <version>. Uses .nvmrc if available'
+ 'exec:run <command> on <version>. Uses .nvmrc if available'
+ 'run:run `node` on <version> with <args> as arguments. Uses .nvmrc if available'
+ 'current:list installed versions'
'ls:list installed versions or versions matching a given description'
+ 'version:resolve the given description to a single local version'
+ 'version-remote:resolve the given description to a single remote version'
'ls-remote:list remote versions available for install'
- 'deactivate:undo effects of NVM on current shell'
+ 'deactivate:undo effects of `nvm` on current shell'
'alias:show or set aliases'
'unalias:deletes an alias'
- 'copy-packages:install global NPM packages to current version'
+ 'reinstall-packages:reinstall global `npm` packages contained in <version> to current version'
+ 'unload:unload `nvm` from shell'
+ 'which:display path to installed node version. Uses .nvmrc if available'
)
_arguments -C '*:: :->subcmds' && return 0
@@ -23,4 +30,4 @@ _arguments -C '*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "nvm subcommand" _1st_arguments
return
-fi \ No newline at end of file
+fi
diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh
index 9dde3a266..4bab8e9d7 100644
--- a/plugins/nvm/nvm.plugin.zsh
+++ b/plugins/nvm/nvm.plugin.zsh
@@ -1,5 +1,8 @@
# Set NVM_DIR if it isn't already defined
[[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm"
-# Load nvm if it exists
-[[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
+# Try to load nvm only if command not already available
+if ! type "nvm" &> /dev/null; then
+ # Load nvm if it exists
+ [[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
+fi