I had this in Vim and miss it dearly now that I'm confined to Visual Studio. I'd like to take this:

MyType type_obj = new MyType();
MyLongerType longer_type_obj = new LongerType()

To this:

MyType     type_obj        = new MyType();
LongerType longer_type_obj = new LongerType()

I have found some macros for this on the web, but they seem to be for an older version of Visual Studio (< 2008). Here is one from 2000.

Edit:

Further digging in Google turned up this one: http://www.omegacoder.com/?p=8

It seems to work to align equals signs, but I haven't yet figured out if it can align the local variable names, too.

Still no clue as to whether I could just get it to perform this sort of behavior with a Ctrl E+D, although that might not be practical considering how it works. (It aligns going down from the line which currently has focus.)

link|improve this question
Do you have a link to the < 2008 macro, perhaps it could be ported. – heavyd Feb 11 '10 at 23:16
feedback

3 Answers

up vote 1 down vote accepted

Here is a link to a code-formatting extension that aligns assignments and declarations.

http://visualstudiogallery.msdn.microsoft.com/7179e851-a263-44b7-a177-1d31e33c84fd

(It's written for VS 2010 so 2008 might not be supported)

link|improve this answer
2  
Could you please provide a bit more than just a link? Describe what it is and what it does, then it will actually be useful to people. A link by itself is not very helpful. – nhinkle Nov 7 '11 at 18:23
feedback

The link you posted provides a working example for VS 2008. From within the Macro Explorer edit a macro module using the IDE. Once the IDE is opened use Project->Add Existing Item to import the .vb file. Once imported you can assign the individual macros to their own keyboard bindings using the Options dialog.

Additionally, have you considered using a VIM plugin to Visual studio? ViMemu seems to have good reviews. This Stack Overflow question has other options.

link|improve this answer
feedback

Look for the macro called LineEmUp in tool/options/keyboard

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.