14

I have recently upgraded to Visual Studio 2012. Whenever I stand on a curly opening bracket and press tab, it automatically inserts 2 new lines and a closing bracket.

{|<- cursor

Pressing tab gives me.

{
    |
}

I wish to disable this behavior. I've searched through the settings, Google and MSDN for the past hour, but I've been unable to find anything that would solve my issue.

I have disabled all installed plugins to see if it would go away, but it didn't.

danijar
  • 32,406
  • 45
  • 166
  • 297
Tha Pear
  • 143
  • 1
  • 5
  • Your not using http://visualstudiogallery.msdn.microsoft.com/0e33cb22-d4ac-4f5a-902f-aff5177cc94d ? If you are, disable it, if not, I am not sure – nycynik Dec 17 '12 at 18:24
  • This also happens when selecting a whole block from the bottom up to indent it. The cursor ends up after the `{` and pressing tab messes everything up. – Gabriel Mar 27 '13 at 17:03

1 Answers1

10

The behavior you are seeing is being caused by a code snippet. Snippets can be activated by typing the snippet shortcut followed by a tab. Visual Studio 2012 comes with several code snippets pre-installed for several different languages. For the C++ language there a default snippet with a shortcut of { which expands to:

{

}

The default snippets can't be disabled easily through the default GUI, however you should be able to remove the snippet file which is located at (for English language):

%VSInstallDir%\VC\Snippets\1033\Visual C++\{.snippet

I believe there are other extensions out there for managing snippets as well.

heavyd
  • 17,303
  • 5
  • 56
  • 74