Vim Auto Indent with newline

Posted by Zen on Stack Overflow See other posts from Stack Overflow or by Zen
Published on 2010-12-18T06:56:35Z Indexed on 2010/12/30 19:53 UTC
Read the original article Hit count: 229

Filed under:
|

How do I get vim to place the cursor within the braces starting on a new line, ie with | denoting the cursor position :

class {
  |
}

right now with my settings it only does this

class {
|}

I got this in my .vimrc file set autoindent shiftwidth=2 tabstop=2 noexpandtab

Basically I just want how a normal IDE would indent it.

update:

I found how to do this with inoremap { {<CR>}<Esc>O

© Stack Overflow or respective owner

Related posts about vim

Related posts about indent