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

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.


There are two options to change that should help get the code looking the way you want. (Coming from Python, it really bothers me if stuff is not indented after a colon.)

I did use James McNellis's answer and change it from "Smart" to "Block", though I'm not sure how much that helped.

There is a setting under Tools -> Options -> Text Editor -> C/C++ -> Formatting -> Indentation -> Indent Access Specifiers which does indent the access specifiers, but doesn't indent the stuff after them.

I also chose "Do nothing" under Tools -> Options -> Text Editor -> C/C++ -> Formatting -> General -> When I paste, so that it doesn't change things just by copy/pasting.

This isn't a perfect solution, but it's at least a little bit closer.