Modified nvm plugin to fit my needs.

This commit is contained in:
André König 2014-08-16 10:50:49 +02:00
commit 1b3f4c1cd6
5 changed files with 37 additions and 10 deletions

3
.gitignore vendored
View file

@ -1,9 +1,6 @@
locals.zsh
log/.zsh_history
projects.zsh
custom
!custom/plugins/example
!custom/example.zsh
*.swp
!custom/example.zshcache
cache/

View file

@ -1,5 +0,0 @@
# Add yourself some shortcuts to projects you often work on
# Example:
#
# brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr
#

View file

@ -1,2 +0,0 @@
# Add your own custom plugins in the custom/plugins directory. Plugins placed
# here will override ones with the same name in the main plugins directory.

26
custom/plugins/nvm/_nvm Normal file
View file

@ -0,0 +1,26 @@
#compdef nvm
#autoload
[[ -s ~/.nvm/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

View file

@ -0,0 +1,11 @@
# The addition 'nvm install' attempts in ~/.profile
if [ -s ~/.nvm/nvm.sh ]; then
. $HOME/.nvm/nvm.sh
# Check if the NODE_VERSION environment variable is set,
# if so trigger nvm to use this.
if [[ $NODE_VERSION != "" ]]; then
nvm use $NODE_VERSION > /dev/null
fi
fi