Tim on January 27th, 2009

My new favorite macro in Visual Studio 2008 is control-D then control-K. Hit that key sequence and voila: all code on the page has been formatted. It’s especially helpful when copy-pasting. Just a tip from Tim to make your life easier! :-)

5 Responses to “Auto Format Code in Visual Studio 2008”

  1. Wrong way around!
    Its control-K then control-D. :)

  2. Doh! Thanks for the correction. :-D

  3. Except when VS gives you a very useful message like “The key combination (Ctrl+K, Ctrl+D) is bound to a command (Form&at Document) which is not currently available.”

    Good times.

  4. Can anybody explain me why i have to use 2 keyboards commands for this?

    In other IDEs i was used (since years) to press CTRL-F and format was done

  5. For me it’s Ctrl-E, Ctrl-D for Format Document, and Ctrl-E, Ctrl-F for Format Selection. Got to Edit -> Advanced to see what it’s set to.

    I think it’s a combination of 2 because there are so many shortcuts now.

Trackbacks/Pingbacks

Leave a Reply

You will be able to edit your comment after submitting.