Gotchacode

A Guide To Your Digital Life.

Configure Sublime Text2 for JavaScript Development.

| Comments

I recently started using Sublime Text2 full time at work after being a vim user for more than 4 years. Vim is really good but it takes sometime to configure it properly. Well this is not a Vim vs ST2 debate. It is more of a vim user shifting to ST2 Tip.

The first thing that you should do is to install package control, it provide really good 3rd party plugins. You can check out the link how to install it. Install Package Control



Once done with that open package manager and install these useful plugins

  • JSHint.
  • JSLint.
  • DocBlockr.
  • AngularJS.
  • Mocha & Mocha snippet 
  • NodeJS.
  • Live Reload.
  • AMD Module Editor
  • Backbone.js
  • Pretty JSON
  • Require Node.js Module Helper

Among, these plugins mocha is the test runner and mocha snippets provides you will snippets to write the tests very fast. Also, there is good plugin for vim mode in Sublime Text2, you can use that if you don’t want to waste the muscle memory. I highly recommend the real time linting with JSHint. It will make you so much more productive and improve your code as well. It acts as the first unit test against the code you just wrote. 

One more important thing, you could set the indentation with tab width equals to 2 spaces. It is a very sane default while writing JavaScript code.

What really struck me was that Sublime Text enabled me to do almost everything i did with Vim without going into the pain of configuration. Also, the learning curve is not at all steep so i could get productive real fast.
2013 Wishes: Sublime Text Terminal

2013 Wishes: Sublime Text Terminal

How do you debug javascript using the chrome debugger

Which mocha plugin are you referring to, the runner? or the snippet package? I'm assuming you mean the runner, but I wasn't sure at first…and in the interest of clarity for others who may also have this question, perhaps you could clarify? My experience with the rest of the plugins was smooth, however.