title: How can I have Vim get this JS indenting right?
body: <p>Emacs user here, giving Vim a go. :)</p>
  
  <p>I like the quick keystrokes and the overall philosphy very much, but I've been hitting some trouble with the slightly more advanced stuff. One of my gripes is indenting (using the <code>=</code> command).</p>
  
  <p>See this JS snippet. This is how Emacs' js2-mode indents it. I like this :</p>
  
  <pre><code>var MyClass = declare([], {
      constructor: function(params) {
          if(!params) {
              params = {};
          }
  </code></pre>
  
  <p>Now this is what Vim does with it. Friggin' hell :</p>
  
  <pre><code>       var MyClass = declare([], {
  constructor: function(params) {
  if(!params) {
  params = {};
  }
  </code></pre>
  
  <p>All the code above this construction gets indented decently, but from there on it simply sucks. And I have this kind of construction a bit all over my code. I've checked <code>:filetype</code> and flipped those switches on. I've tried with and without plugins. Not getting it right. Vim is gVim 7.4, downloaded a couple of days ago. I've seen <a href="https://stackoverflow.com/questions/3223695/javascript-indentation-in-vim">this question</a> and the snippet shown there is indented correctly out of the box.</p>
  
  <p>Does anybody have a clue what I could attempt here ?
  Thanks for any advice !</p>