Search code examples
c++visual-studio-2010indentationaccess-modifiers

C++ access modifier auto indentation in Visual Studio 2010 slowly driving me crazy - can it be changed?


When programming C++ in Visual Studio, it insists on giving me these awful indentations on access modifiers - my condolences if anyone actually likes them this way ;) (a joke folks!)

public class MyClass
{
public:
   MyClass();
   ~MyClass();
   int wowAnInt();
}

Needless to say, I want this:

public class MyClass
{
    public:
       MyClass();
       ~MyClass();
       int wowAnInt();
} 


Is there any way to achieve this using anything (I've got ReSharper and Highlighter) or perhaps vanilla VS?


Solution

  • The closest you can get with the built-in Visual Studio editor settings is to change the indenting mode from "Smart" to "Block" (Tools -> Options -> Text Editor -> C/C++ -> Tabs -> Indenting).

    When you do this, you can indent anything however you like, you just lose the "automatic indenting." Basically, whenever you press [enter] the new line will be indented the same number of tab stops / spaces as the previous line and it won't automatically reformat lines to get them to line up.