Gabirel / Hack-SpaceVim

🚀 Tell you how to hack SpaceVim. Be useful. Try Discussions!
MIT License
475 stars 68 forks source link

IDE for Web developer/Node/JavaScript #30

Closed Gabirel closed 6 years ago

Gabirel commented 6 years ago

Teach you how to make SpaceVim become a IDE for JavaScript

Gabirel commented 6 years ago

Requirements

Installation

SpaceVim

Make sure your SpaceVim is up-to-date.

Install npm or cnpm

Here are the examples:

Arch:

sudo pacman -S npm nodejs

Fedora:

sudo dnf install npm nodejs

Ubuntu:

sudo apt install npm nodejs

Install tern

You 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:

npm install tern

Or

cnpm install tern

PS: If you want to execute, please install cnpm.

Add config into your ~/.SpaceVim.d/init.vim

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 install

Config

The most important step is about how to configure your environment.

Actually, it's pretty easy.

It has two optinos for config.

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!!!

Credits & Thanks

Thanks to @RenChunhui, I can make this topic happen. I could never reach so for without his unselfish help.