Closed Lilja closed 1 year ago
Try using $nvm_data.
If you want to get the path of the current Node:
$nvm_data/(nvm current)
If you want to get the path of a specific Node:
$nvm_data/v18.8.8
I don't have that environmental variable in my env. I was on 2.2.6
and updated to 2.2.11
, I did nvm use v16.16.0
but no nvm_data
:
lilja in ~/dotfiles on master λ nvm use v16.15.0
Now using Node v16.15.0 (npm 8.5.5) ~/.local/share/nvm/v16.15.0/bin/node
ilja in ~/dotfiles on master λ env | grep nvm
nvm_current_version=v16.15.0
You must have that variable in your environment as it's set both during installation:
and update:
I did echo $nvm_data
, and it worked. Surprised that env | grep nvm
doesn't work for it.
Nevertheless, I'll try that out for now and experiment.
Thanks for your help and your great project!
$nvm_data is not exported, that's why it's not available to env
, but you can query Fish variables using just set
.
$ set | string match nvm\*
nvm_current_version v19.0.1
nvm_data /Users/jb/.local/share/nvm
nvm_default_version latest
nvm_mirror https://nodejs.org/dist
Hi!
I'm using neovim heavily and have thought how to make best use of both worlds.
One problem that I'm running into constantly is that I have two node versions on my machine,
v18
andv16
. On node 18 I have my LSPs and the v16 is mostly for running a specific project. Since most of my stuff for my developer environment is for v18, I get lots of errors when I accidentally open neovim with it. I usually have to quit vim, donvm use v18.8.8
and then re-open vim.This is a bit tedious and I would've think that there must be people that have the same problem.
In neovim, there is a option that you define a global variable called
g:node_host_prog
. Which I guess you could donvm use v18.8.0 && which node
and paste that into there. But this won't work well with other machines as you often tend to share dotfiles. Would it be feasible to add a command to get the path of a particular node managed by nvm? For example, in nvim I could define:let g:node_host_prog=system("nvim get-path lts/gallium")
Let me know if I can clarify anything or if I'm missing something.