Skip to content

Commit

Permalink
Allow snippet, nvm use default only if we're interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgebucaran committed Jan 1, 2021
1 parent a75accc commit abea3e7
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions conf.d/nvm.fish
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
status is-interactive || exit

set --query XDG_DATA_HOME \
&& set --global nvm_data $XDG_DATA_HOME/nvm \
|| set --global nvm_data ~/.local/share/nvm
set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist

if set --query nvm_default_version && ! set --query nvm_current_version
nvm use $nvm_default_version >/dev/null
end

function _nvm_install -e nvm_install
test ! -d $nvm_data && command mkdir -p $nvm_data
echo "Downloading the Node distribution index for the first time..." 2>/dev/null
Expand All @@ -23,3 +17,6 @@ function _nvm_uninstall -e nvm_uninstall
functions --erase (functions --all | string match --entire --regex "^_nvm_")
complete --erase --command nvm
end

status is-interactive && set --query nvm_default_version && ! set --query nvm_current_version &&
nvm use $nvm_default_version >/dev/null

0 comments on commit abea3e7

Please sign in to comment.