Simplify nvm item, everyone is using nvm current now

This commit is contained in:
Ilan Cosman 2020-12-17 20:53:47 -08:00
parent c577cbee9d
commit aaf4386dc7
2 changed files with 9 additions and 13 deletions

View File

@ -121,10 +121,9 @@ 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 |
## os

View File

@ -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