Can global `tern` binary be use?
wizzup opened this issue · 4 comments
wizzup commented
I am on NixOS and neovim.
I have tern
available in my development shell (nix-shell).
$ which tern
/nix/store/n8in6vzvpklf1qpnrygz1dpqypqjab4f-node-tern-0.21.0/bin/tern
I get following error in vim when run :TernDoc
Failed to start server:
module.js:471
throw err;
^
Error: Cannot find module '/home/wizzup/.config/nvim/plugged/tern_for_vim/node_modules/tern/bin/tern'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
Press ENTER or type command to continue
Is there any configuration can I set to make use of tern
in my $PATH instead of the one in plugin directory so I can have only single tern
installation?
This is how I install plugin in $MYVIMRC
using vim-plug.
Plug 'ternjs/tern_for_vim', { 'for': 'javascript' }
wizzup commented
chemzqm commented
You could use somthing like let g:tern#command = ['node', expand('~').'/lib/tern/bin/tern']
in your .vimrc
wizzup commented
solved by let g:tern#command = ['tern']
jlangloisp commented
Sorry to revive this, but you can also do:
let g:tern#command = [ '${pkgs.nodePackages.tern}/bin/tern' ]
if you don't want to rely on your user environment and you're using vim_configurable.