diff options
author | Marvin Borner | 2019-03-05 01:09:01 +0100 |
---|---|---|
committer | Marvin Borner | 2019-03-05 01:09:01 +0100 |
commit | 55457187d18221e76bd12f0fb2cfab65c49b92fb (patch) | |
tree | 8db042d2d80710d54100c2709ad4332153ac848a /.oh-my-zsh/plugins/nvm |
Initial commit
Diffstat (limited to '.oh-my-zsh/plugins/nvm')
-rw-r--r-- | .oh-my-zsh/plugins/nvm/README.md | 9 | ||||
-rw-r--r-- | .oh-my-zsh/plugins/nvm/_nvm | 33 | ||||
-rw-r--r-- | .oh-my-zsh/plugins/nvm/nvm.plugin.zsh | 5 |
3 files changed, 47 insertions, 0 deletions
diff --git a/.oh-my-zsh/plugins/nvm/README.md b/.oh-my-zsh/plugins/nvm/README.md new file mode 100644 index 0000000..079cf00 --- /dev/null +++ b/.oh-my-zsh/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/.oh-my-zsh/plugins/nvm/_nvm b/.oh-my-zsh/plugins/nvm/_nvm new file mode 100644 index 0000000..1eec48b --- /dev/null +++ b/.oh-my-zsh/plugins/nvm/_nvm @@ -0,0 +1,33 @@ +#compdef nvm +#autoload + +[[ -f "$NVM_DIR/nvm.sh" ]] || return 0 + +local -a _1st_arguments +_1st_arguments=( + 'help:show help' + '--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>. 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' + 'alias:show or set aliases' + 'unalias:deletes an alias' + '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 + +if (( CURRENT == 1 )); then + _describe -t commands "nvm subcommand" _1st_arguments + return +fi diff --git a/.oh-my-zsh/plugins/nvm/nvm.plugin.zsh b/.oh-my-zsh/plugins/nvm/nvm.plugin.zsh new file mode 100644 index 0000000..9dde3a2 --- /dev/null +++ b/.oh-my-zsh/plugins/nvm/nvm.plugin.zsh @@ -0,0 +1,5 @@ +# 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" |