javascriptjqueryvimautocompletetern

Figuring out JavaScript libraries for Vim autocompletion with TernJS in .tern_project file


I love vim and want to keep using it to do web development although I am struggling setting up my .tern_project file with the correct libraries I need to do autocompletion. I am relatively new to JavaScript but what I have so far is making it a lot easier to learn.

There aren't many examples that I could find and I have tried to read the documentation but I do not know enough for it to be helpful. So far my .tern_project file looks like this:

{
  "libs": [
    "browser",
    "ecma6"
  ],
  "plugins": {
    "requirejs": {
      "baseURL": "./",
      "paths": {}
    }
  }
}

I don't really know what the plugins do but I left them in for now, in libs the ecma6 really helped me with all the array methods (ie. forEach etc.). Now my question is how do I add stuff like console.table() to autocomplete?

Which library do I need to add to the .tern_project file?

Also, I am open to suggestions for better web development environments.


Solution

  • List of available tern libs:

    You could always get an updated list of libs from tern js repository defs directory

    List of available tern plugins :

    You could always get an updated list of plugins from tern js repository plugin directory

    As your javascript skills grow go add and play with libs and plugins and see what completions you get. Also note that you could have multiple .tern-project file. Tern will always search upward to root directory and uses the closest one. so you could configure completions on a project basis.