From b811acde9dc7f8ea453bbd3ddaa9697fdbaa6d20 Mon Sep 17 00:00:00 2001 From: Tobias Gurtzick Date: Mon, 12 Mar 2018 14:27:13 +0100 Subject: [PATCH] add nvmng plugin This adds the nvmng plugin, which loads nvm with the flag --fast-reuse, which is exposed by nvm-ng. This is a hard fork of nvm which contains patches that accelerate load time for nvm, to get back to a more smooth behavior of your shell. Signed-off-by: Tobias Gurtzick --- plugins/nvmng/_nvm | 26 ++++++++++++++++++++++++++ plugins/nvmng/nvmng.plugin.zsh | 5 +++++ 2 files changed, 31 insertions(+) create mode 100644 plugins/nvmng/_nvm create mode 100644 plugins/nvmng/nvmng.plugin.zsh diff --git a/plugins/nvmng/_nvm b/plugins/nvmng/_nvm new file mode 100644 index 000000000..1414dcbb1 --- /dev/null +++ b/plugins/nvmng/_nvm @@ -0,0 +1,26 @@ +#compdef nvm +#autoload + +[[ -f "$NVM_DIR/nvm.sh" ]] || return 0 + +local -a _1st_arguments +_1st_arguments=( + 'help:show help' + 'install:download and install a version' + 'uninstall:uninstall a version' + 'use:modify PATH to use version' + 'run:run version with given arguments' + 'ls:list installed versions or versions matching a given description' + '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' + 'copy-packages:install global NPM packages to current version' +) + +_arguments -C '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "nvm subcommand" _1st_arguments + return +fi \ No newline at end of file diff --git a/plugins/nvmng/nvmng.plugin.zsh b/plugins/nvmng/nvmng.plugin.zsh new file mode 100644 index 000000000..b7db580a2 --- /dev/null +++ b/plugins/nvmng/nvmng.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" --fast-reuse