Skip to content

Commit

Permalink
nvm plugin improvements (#5265)
Browse files Browse the repository at this point in the history
* Export $NVM_DIR if it doesn't exist and use it when looking for nvm
* Use $NVM_DIR when looking for nvm for completion
* Use $NVM_DIR when looking for nvm in nvm_prompt_info
  • Loading branch information
lukechilds authored and mcornella committed Aug 7, 2016
1 parent 7654b16 commit a7de0fa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/nvm.zsh
@@ -1,6 +1,6 @@
# get the node.js version
function nvm_prompt_info() {
[ -f "$HOME/.nvm/nvm.sh" ] || return
[[ -f "$NVM_DIR/nvm.sh" ]] || return
local nvm_prompt
nvm_prompt=$(node -v 2>/dev/null)
[[ "${nvm_prompt}x" == "x" ]] && return
Expand Down
2 changes: 1 addition & 1 deletion plugins/nvm/_nvm
@@ -1,7 +1,7 @@
#compdef nvm
#autoload

[[ -s ~/.nvm/nvm.sh ]] || return 0
[[ -f "$NVM_DIR/nvm.sh" ]] || return 0

local -a _1st_arguments
_1st_arguments=(
Expand Down
6 changes: 4 additions & 2 deletions plugins/nvm/nvm.plugin.zsh
@@ -1,3 +1,5 @@
# The addition 'nvm install' attempts in ~/.profile
# Set NVM_DIR if it isn't already defined
[[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm"

[[ -s ~/.nvm/nvm.sh ]] && . ~/.nvm/nvm.sh
# Load nvm if it exists
[[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"

0 comments on commit a7de0fa

Please sign in to comment.