Samaursa
Samaursa

Reputation: 17197

Visual Studio Auto Format Curly Brace on Next Line

I am so used to code like this:

if (...)
{
   //somecode
}

that I simply have to change the following to the above:

if (...){
   //somecode
}

I get a lot of code from other people that I have to go through and sometimes this is what I get. Is it possible to auto-format that in Visual Studio 2008 for C++?

Now some may think I should get used to it. Believe me, I am trying, but it is very distracting and I hope there is a simple solution.

Upvotes: 2

Views: 1848

Answers (1)

Mark Tolonen
Mark Tolonen

Reputation: 177461

VS2008 has a simple formatter (Edit menu, Advanced, Format Selection), but it doesn't move braces.

Check out astyle and its --style=ansi flag.

Upvotes: 5

Related Questions