diff --git a/docs/Configuration.md b/docs/Configuration.md index 27c6338..d0dc241 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -120,12 +120,11 @@ Most of Tide's git capabilities are inherited from fish's built-in [fish_git_pro ## nvm -| Variable | Description | Type | -| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -| bg_color | background color of nvm item | color | -| color | color of nvm item | color | -| default_node | treated as the "system" version of node. The nvm item doesn't display when this version is active. This variable is useful for users of [nvm.fish][], which has no conception of a "system" version. | string | -| icon | icon for the nvm item | string | +| Variable | Description | Type | +| -------- | ---------------------------- | ------ | +| bg_color | background color of nvm item | color | +| color | color of nvm item | color | +| icon | icon for the nvm item | string | ## os diff --git a/functions/_tide_item_nvm.fish b/functions/_tide_item_nvm.fish index a479872..5493a48 100644 --- a/functions/_tide_item_nvm.fish +++ b/functions/_tide_item_nvm.fish @@ -1,12 +1,9 @@ function _tide_item_nvm - if set -l nodePath (command --search node) # Ensure node is installed - set -l nodeVersion (string split / $nodePath)[-3] # Much faster than node --version - - if string match --quiet --regex "^$NVM_DIR.*" $nodePath || # If node path begins with NVM_DIR - test -n "$tide_nvm_default_node" -a "$nodeVersion" != "$tide_nvm_default_node" - + if functions --query nvm + set -l nvmCurrent (nvm current) + if test "$nvmCurrent" != system set_color $tide_nvm_color - printf '%s' $tide_nvm_icon' ' $nodeVersion + printf '%s' $tide_nvm_icon' ' $nvmCurrent end end end \ No newline at end of file