Skip to content
Advertisement

Recommended Vim plugins for JavaScript coding? [closed]

I’m new to JS & Vim. Which plugins would help me to write Javascript code?

Advertisement

Answer

Syntax Checking / Linting

There is a very easy way to integrate JSLint or the community-driven jshint.com (which is much better IMO) with Vim using the Syntastic Vim plugin. See my other post for more info.

Source-Code browsing / Tag-list

There’s also a very neat way to add tag-listing using Mozilla’s DoctorJS (formerly jsctags), which is also used in Cloud9 IDE‘s Ace online editor.

  1. Install the following packages using your favorite package-manager (Ubuntu’s apt-get, Mac’s home brew, etc.):
    1. exuberant-ctags
  • NOTE: After installing make sure running ctags actually runs exuberant-ctags and not the OS’s preinstalled ctags. You can find out by executing ctags --version. 2. node (Node.js)
  1. Clone DoctorJS from github: git clone https://github.com/mozilla/doctorjs.git
  2. Go inside DoctorJS dir and make install (You’ll also need the make app installed, but this is very basic).
  • There’re some bugs with installing the plugin, make install doesn’t do the trick for the moment. For now I just add the repo’s bin/ dir to my $PATH instead. See DoctorJS’s GitHub and issues pages for more info.
  1. Install the TagBar Vim plugin (NOTE: It’s TagBar, not the old infamous TagList!).
  2. PROFIT. 🙂

New Project – Tern.js

DoctorJS is currently dead. There’s a new promising project called tern.js. It’s currently in early beta, and should eventually replace it.

There is a project ramitos/jsctags which uses tern as its engine. Just npm install -g it, and tagbar will automatically use it for javascript files.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement