mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2025-12-06 07:20:40 +01:00
nvm: use nvm current in nvm_prompt_info and look in alternate install locations
This makes it work regardless of where nvm is loaded from. And it uses nvm's version strings, which distinguish the "system" and "none" NVM environments, instead of reporting the specific version of the system node.js or erroring, respectively. Fixes #4336 Closes #4338
This commit is contained in:
committed by
Marc Cornellà
parent
fc6c9ca4b4
commit
ef44416df2
@@ -1,9 +1,8 @@
|
||||
# get the node.js version
|
||||
# get the nvm-controlled node.js version
|
||||
function nvm_prompt_info() {
|
||||
[[ -f "$NVM_DIR/nvm.sh" ]] || return
|
||||
local nvm_prompt
|
||||
nvm_prompt=$(node -v 2>/dev/null)
|
||||
[[ "${nvm_prompt}x" == "x" ]] && return
|
||||
nvm_prompt=${nvm_prompt:1}
|
||||
which nvm &>/dev/null || return
|
||||
nvm_prompt=$(nvm current)
|
||||
nvm_prompt=${nvm_prompt#v}
|
||||
echo "${ZSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt}${ZSH_THEME_NVM_PROMPT_SUFFIX}"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user