Nitin Aggarwal
Nitin Aggarwal

Reputation: 215

Formatting tool for sublime text

I am looking for a formatting/indetation tool for sublime text 2, which on ctrl+s turns the following code

if(a==2){b=a+2;}

to something like

if(a == 2) {
   b = a + 2;
}

I can't find anything useful. Please help.

Upvotes: 1

Views: 22218

Answers (4)

Nitin Aggarwal
Nitin Aggarwal

Reputation: 215

I have worked around an easy solution for my code indentation/formatting problem. I am using an online formatting tool JSBeautifier. I just copy my whole code and paste it in jsbeautifier and after it formats my code I copy my formatted code and paste it back to my js file.

Upvotes: -10

Enteleform
Enteleform

Reputation: 3823

CoolFormat offers various bracket, indentation, whitespace, & formatting styles for the following langauges:

  • C, C++, C#, CSS, HTML, Java, JavaScript, JSON, Objective-C, PHP, SQL, XML

Upvotes: 2

Ali Mamedov
Ali Mamedov

Reputation: 5256

You can use JsFormat

JsFormat is a JavaScript formatting plugin. Behind the scenes, it uses the command line formatter from jsbeautifier.org to format full or portions of JavaScript and JSON files.

Upvotes: 7

PlayMa256
PlayMa256

Reputation: 6831

Try Beautify or HTML/CSS/JS beautify

Upvotes: 3

Related Questions