views:

163

answers:

2

Hi, I recently installed Visual Studio 2010 for my c++ course at school. Im very used using emacs scheme in netbeans and eclipse, its hard wired into my brain, the hotkeys.

At my frustration, after installing the emacs scheme (the extension) for visual studio 2010, and also enable the keymap via tools -> options -> keyboard, the auto indent stops working, and it is driving me nuts.

I asked my teacher, he had no clue, as he does not even use emacs. I have checked that auto indent is indeed on via tools -> options -> Text Editor -> All languages -> Tabs. In here, I set 'Indenting' too smart, and basically just sets it up. Fine, I press okey, nothing happens, and when I check it again, it has been disabled. It wont save the changes it seems, or emacs sets it back to default. So basically when I try to enable auto indent via "All languages", it resets back after pressing okey.

However, if I check tools -> options -> Text Editor -> C/C++ (instead of all language as above), the indenting is set to smart, but it wont affect the editor, still no automatic indent.

I hope anyone has experienced this, and could give a helping hand in my situation, would be greatly appreciated. Using arrow keys to move around is for me a painful thing to do.

+2  A: 

The behavior you are describing is by design. Emacs does not auto-indent new lines. Once you press enter, a new line is added to the buffer and the caret is placed on the first column of the new line. We turn off the auto-indent option automatically to mimic that Emacs behavior.

Please note that you can press tab on an empty line to auto-indent the line and move the caret to the correct column automatically.

The issues pointed out by Ray are already fixed and the copy of the extension you have should have the fix. I've contacted the program manager in charge of the page to update the page and update the Known Issues section.

Thanks for trying the extension out! If you run into issues, please feel free to open defects at http://connect.microsoft.com/visualstudio

Ameen Tayyebi Jazayeri
Thank you for clearing this up, I did not know it was by design, as it worked differently in netbeans and eclipse. I am no veteran emacs user, just very fond of its hotkey setup, and I like to have consistent layout of keys. I dislike using the mouse or arrow keys to move around, might be just a bad habit I have.
+1  A: 

Use the key bindings CTRL + J instead of Enter. It is bound to

Edit.EmacsBreakLineIndent

It inserts a new line and indents it which is the same behavior in Emacs proper.

It also appears to support "smart" indent by indenting appropriately after curly braces {} (at least it does for me in the VS C# text editor with ReSharper installed.)

Ray Vega
Thank you so much, this is simply exactly what I needed.