title: Vim - automatic open close braces and move cursor
body: <p>I'm new to Vim and right now i just need a very simple thing:</p>
  
  <pre><code>(1)public class Foo &lt;open brace&gt;&lt;hit ENTER&gt; 
  or
  (2)public class Foo &lt;hit ENTER&gt;&lt;open brace&gt;&lt;hit ENTER&gt;
  </code></pre>
  
  <p>To get this</p>
  
  <pre><code>(1)public class Foo{
     |cursor here
  }
  </code></pre>
  
  <p>or</p>
  
  <pre><code> (2)public class Foo
   {
      |cursor here
   }
  </code></pre>
  
  <p>My .vimrc is:</p>
  
  <pre><code>set smartindent
  set shiftwidth=4
  set number
  inoremap { {&lt;CR&gt;}&lt;Left&gt;
  </code></pre>
  
  <p>Appreciate any help, thanks!</p>