ohmyzsh/lib/nvm.zsh
Andrew Janke ef44416df2 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
2020-10-09 17:21:03 +02:00

9 lines
265 B
Bash

# get the nvm-controlled node.js version
function nvm_prompt_info() {
local nvm_prompt
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}"
}