title: How do you auto indent a block in vim
body: <p>I'm having a hard time figuring this out. I'm typing the following with the help of the AutoClose.vim plugin:</p>
  
  <pre><code>function trim() {|}
  </code></pre>
  
  <p>| is the position of my cursor. What I want to achieve is as soon as I hit enter the code should look like:</p>
  
  <pre><code>function trim() {
      |
  }
  </code></pre>
  
  <p>Instead, what happens now is:</p>
  
  <pre><code>function trim() {
  |}
  </code></pre>