Ctrl+k, Ctrl+d not available in Visual Studio 2010 working on C++ project
Asked Answered
S

2

12

I got used to use Ctrl+k, Ctrl+d for formatting whole document while in Visual Studio 2010 C# but when I changed C++ I realise that it's no longer available.

To format the document I have to select a piece of code and use Ctrl+k, Ctrl+f to format the selected code.

Can someone tell me how to enable Ctrl+k, Ctrl+d ? Is it possible ?

enter image description here

Scurrility answered 11/1, 2012 at 0:29 Comment(8)
According to this post, the workaround is Select All then Format Selection: Ctrl A, Ctrl K, Ctrl F: #2179693Thimbleweed
@Thimbleweed Yes I know, but i was curious if it is possible to get Ctrl+k, Ctrl+d workingScurrility
Sorry, I meant to imply that it seems to be the only workaround last time it was asked.Thimbleweed
Sure, you can re-assign any keystroke. Tools + Customize + Keyboard. Type "Edit.Format", you can choose what you want from there.Myrt
@HansPassant You can reassign but it will still be unavailable right ?Scurrility
Not sure what I need to do to make you actually try this for yourself.Myrt
I'm guessing that the C++ project subsystem doesn't support the "Format Document" command - there's nothing you can do without writing a ton of code - you'd effectively have to create a project subtype of the C++ projects, and then possibly write an extension to automatically convert all standard C++ projects to be your subtype, all for the sake of avoiding learning a new key sequence.Talapoin
All behaviors for Formatting Documents are now consistent across all file formats (documents, code files, etc.) in the latest Visual Studio 2017. social.msdn.microsoft.com/Forums/vstudio/en-US/…Desinence
C
10

Ctrl+K, Ctrl+F works on code files (C++, C#, VB).

Ctrl+K, Ctrl+D works on document files (HTML, XML, XAML)

Clientage answered 19/11, 2012 at 8:19 Comment(0)
T
3

If you are annoyed by the workaround Ctrl+a, Ctrl+k, Ctrl+f because you end up at the end of your document, just add Ctrl+- to bring the cursor back to where it was before.

Tytybald answered 29/5, 2013 at 15:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.