# VS2005 Emacs Keybinding indentation problem

This topic is 4508 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I set the keybinding under Tools --> Options --> Environment --> Keyboard to include Emacs style. Now the indentation's are definetly incorrect, here is an example of how it thinks it should look:
int main()
{
int i = 0;   //This line is definetly indented wrong
}


That is definetly not right. Any advice? Thanks, Halsafar

##### Share on other sites
If you have 'indent braces' turned on, it is correct, because that style means 'indent the braces the same as the body'. Turning the option off will make only the stuff between the braces be indented.

As far as I'm aware, there is not an option to indent the braces and indent the stuff between them more.

##### Share on other sites
(sigh) I really like the Emacs style of indenting tho:

This (Emacs):
int main()    {          int i = 0;   //This line is definetly indented wrong    }

Vs:
int main(){      int i = 0;   //This line is definetly indented wrong}

You are correct tho, if I turned off auto-indenting of braces then it works like the latter. Still not as nice as Emacs tho...

Thanks,
Halsafar

##### Share on other sites
You could try asking somebody on the MSDN Forums. That community is more likely to know about some hidden/obscure feature that gives you what you want.

Re-reading your original post, though, it seems like you want the braces indented and everything between the braces at the same level as the braces? I can't speak for VS2005, but I'm almost certain that 2002 does exactly that when you tell it to indent braces. I could be wrong, though.

##### Share on other sites
This is the indenting structure I am used to:

int main()    {          int i = 0;        if (i)            {                int j = 0;            }     }

I took your advice and posted on a microsoft forum for VC8.

• 10
• 40
• 15
• 10
• 23