Setup Ternjs Node/Javascript autocomplete plugin for Vim editor

Written on 06 June 2016

Ternjs is a stand-alone code-analysis engine for JavaScript Ternjs. It is an intelligent code completion for javascript.

To use Ternjs you must install Nodejs and Python.

Install TernJS for Vim

Place this in your .vimrc:
For Vundle

Plugin 'ternjs/tern_for_vim'

Then type vim +PluginInstall

cd ~/.vim/bundle  
cd tern_for_vim  
npm install  

For Plug

Plug 'ternjs/tern_for_vim', {'do':'npm install '}

Then type vim +PlugInstall

For pathogen

cd ~/.vim/bundle  
git clone  
cd tern_for_vim  
npm install  

Config Ternjs show autocompletion with Subpertab.

Install Supertab

//Vim bundle
Plugin 'ervandew/supertab'

//Plug Vim plugin manager
Plug 'ervandew/supertab'

cd ~/.vim/bundle  
git clone  

Then add these line to .vimrc

autocmd FileType javascript let g:SuperTabDefaultCompletionType = "<c-x><c-o>"  
set completeopt-=preview  

Add file name .tern-project to your project folder.

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

Now edit some js file and hit tab to show autocompletion
Ternjs for Vim and Supertab

Happy codding