Here are the examples:
Arch:
sudo pacman -S npm nodejsFedora:
sudo dnf install npm nodejsUbuntu:
sudo apt install npm nodejsYou have to install tern since tern_for_vim using tern as a server to provide auto-completion. (If I was wrong, please tell me. Because I am not a expert of nodejs)
Just Simply run:
cd ~/.cache/vimfiles/repos/github.com/ternjs/tern_for_vim
npm install ternOr
cnpm install ternPS: If you want to execute, please install cnpm.
call SpaceVim#layers#load('lang#javascript')And restart your vim to let SpaceVim itself to install plugins for you.
If it takes a long time to install tern_for_vim, please install it manually by 3 steps below:
$ cd ~/.cache/vimfiles/repos/github.com/ternjs
$ git clone https://github.com/ternjs/tern_for_vim
$ cd tern_for_vim; npm installThe most important step is about how to configure your environment.
Actually, it’s pretty easy.
It has two optinos for config.
-
Option A:
.tern-project(in the current directory or one of the directories above that for this project only) -
Option B:
.tern-config(default in your home directory)
See more details here
Here’s the example config:
{
"plugins": {
"node": {},
"node_resolve": {},
"es_modules": {},
"modules": {}
},
"libs": [
"browser",
"ecma5",
"ecma6",
"react"
],
"ecmaVersion": 6
}That’s it!!!
Thanks to @RenChunhui, I can make this topic happen. I could never reach so for without his unselfish help.