ohmyzsh/lib/nvm.zsh
Andrew Janke e391fd94a7 lib/nvm: Use which nvm and nvm current
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.
2016-08-11 23:21:28 -04:00

9 lines
304 B
Bash

# get the nvm-controlled node.js version
function nvm_prompt_info() {
[[ -f "$NVM_DIR/nvm.sh" ]] || return
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}"
}