tide/functions/_tide_item_nvm.fish

13 lines
600 B
Fish
Raw Normal View History

2020-09-06 21:23:47 +03:00
function _tide_item_nvm
2020-09-08 05:53:12 +03:00
if set -l nodePath (command --search node) # Ensure node is installed
set -l nodeVersion (string split / $nodePath)[-3] # Much faster than node --version
2020-09-07 04:10:10 +03:00
2020-09-08 17:29:24 +03:00
if string match --quiet --regex "^$NVM_DIR.*" $nodePath # If node path begins with nvm directory
set_color $tide_nvm_color
printf '%s' $tide_nvm_icon' ' $nodeVersion
2020-09-12 08:15:25 +03:00
else if test -n "$tide_nvm_default_node" -a "$nodeVersion" != "$tide_nvm_default_node"
2020-09-07 04:10:10 +03:00
set_color $tide_nvm_color
printf '%s' $tide_nvm_icon' ' $nodeVersion
end
2020-09-06 21:23:47 +03:00
end
2020-09-07 04:10:10 +03:00
end