You can select all your code ( ctrl + A ) and use the functionality in the Reindent application (Edit â Line â Reindent) . It will format your code by looking at the Sublime / Intent tab.
Alternatively: You can use the JsFormat formatting plugin for Sublime Text 2 if you would like to have more custom settings on how to format your code to add default Sublime Text to the tab / indent tab.
https://github.com/jdc0589/JsFormat
More on how to install JsFormat in your Sublime IDE:. You can easily install JsFormat using package management (Preferences â Package Control). Open package management, then type install, press enter. Then type "js format" and press enter , you're done. (The package controller will show the installation status with success and errors in the lower left pane of Sublime)
Abbreviation settings: Add the following lines to your key bindings (Preferences â Keyboard Binding User)
{ "keys": ["ctrl+alt+2"], "command": "js_format"}
I use ctrl + alt + 2 , you can change this short cut key as you want.
My opinion: JsFormat - good, definitely worth a try!
Gokhan Tank Jun 24 '13 at 23:41 2013-06-24 23:41
source share