title: How do I format JavaScript program in TextMate?
body: <pre><code>$(document).ready(function() {
  $("body").hide().fadeIn(250);
  })
  </code></pre>
  
  <p>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 <em>carriage return</em> is added at the end.</p>
  
  <p>If I select all the three lines and press ^Q, The code gets formatted as below.</p>
  
  <pre><code>$(document).ready(function() { $("body").hide().fadeIn(250); })
  </code></pre>
  
  <p>If I select the code snippet at the top and press ^J, I again get </p>
  
  <pre><code>$(document).ready(function() { $("body").hide().fadeIn(250); })
  </code></pre>
  
  <p>What should I do to get the code formatted as below?</p>
  
  <pre><code>document).ready(function() {
      $("body").hide().fadeIn(250);
  })
  </code></pre>