Commit a7de0fab authored by Luke Childs's avatar Luke Childs Committed by Marc Cornellà

nvm plugin improvements (#5265)

* 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
parent 7654b16b
# get the node.js version # get the node.js version
function nvm_prompt_info() { function nvm_prompt_info() {
[ -f "$HOME/.nvm/nvm.sh" ] || return [[ -f "$NVM_DIR/nvm.sh" ]] || return
local nvm_prompt local nvm_prompt
nvm_prompt=$(node -v 2>/dev/null) nvm_prompt=$(node -v 2>/dev/null)
[[ "${nvm_prompt}x" == "x" ]] && return [[ "${nvm_prompt}x" == "x" ]] && return
......
#compdef nvm #compdef nvm
#autoload #autoload
[[ -s ~/.nvm/nvm.sh ]] || return 0 [[ -f "$NVM_DIR/nvm.sh" ]] || return 0
local -a _1st_arguments local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
......
# 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"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment