2

Currently for CoC I am setting the nodejs path like this:

let g:coc_node_path = '/usr/local/.nvm/versions/node/v12.4.0/bin/node'

But I want this variable to be set to the output of which node. How can I do this? The CoC config guide does not mention this, and it's my understanding that this is a vim script specific feature.

1 Answer 1

2

Perhaps I should have searched the internet more before I asked this question. I was able to accomplish what I needed using the system function.

So here I needed to do:

let g:coc_node_path = substitute(system('which node'), '\n', '', '')

The substitute is necessary because we need to get rid of the new line at the end of the output, otherwise the path is invalid.

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.