Applying Space Formatting in Visual Studio
In vim, if you, say, copy a block of code into a file and it gets all awkward, you can press == or = G to apply space formatting to the line (or to the end of the file). Is there a way to get this functionality in Visual Studio 2008? I found this stone:
Ctrl-K, Ctrl-F Applies indentation and space formatting for the language, as specified in the Formatting panel, in the Text Editor section of the Options dialog box, to the selected text.
I'm not sure what this means and when I tested it I didn't get anything.
source to share
Try CTRL+ K, CTRL+D
You can define the current mapping by going to Tools β Options β Environment β Keyboard β enter "Document Format" and select an option Edit.FormatDocument
. Check the Shortcuts for Selected Command drop-down list.
For example, in Visual Studio Team System 2008 Development Edition with environment setup for C # I see 3 assignments:
- CTRL+ K, CTRL+D
- CTRL+ E, CTRL+D
- CTRL+ E,D
Alternatively from the menu: Edit β Advanced β Document Format.
Depending on the development options you originally selected when you first started Visual Studio, this menu will change. Based on my observations, the above applies to General, C #, VB and Project Management.
If you chose web development, the option will be Edit β Format Document.
To reset your environment settings: Tools -> Import and Export Options ... -> reset all settings -> Save current settings (optional) -> Select a default preset from the list provided.
source to share