Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I format JavaScript program in TextMate?

Tags:

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);
})
like image 825
Ken Russell Avatar asked Dec 27 '22 19:12

Ken Russell


1 Answers

Using the Javascript tmbundle, Ctrl + Shift + H

like image 149
Igbanam Avatar answered Mar 28 '23 16:03

Igbanam