Ken Russell
Ken Russell

Reputation: 2378

How do I format JavaScript program in TextMate?

$(document).ready(function() {
$("body").hide().fadeIn(250);
})

If I place the cursor at the end of the above code (the only lines of code in the file and the file is saved as sample.js) and press ^Q, a carriage return is added at the end.

If I select all the three lines and press ^Q, The code gets formatted as below.

$(document).ready(function() { $("body").hide().fadeIn(250); })

If I select the code snippet at the top and press ^J, I again get

$(document).ready(function() { $("body").hide().fadeIn(250); })

What should I do to get the code formatted as below?

document).ready(function() {
    $("body").hide().fadeIn(250);
})

Upvotes: 4

Views: 1945

Answers (1)

Igbanam
Igbanam

Reputation: 6082

Using the Javascript tmbundle, Ctrl + Shift + H

Upvotes: 10

Related Questions