Search code examples
visual-studiocommentsvisual-studio-2012

What are the key shortcuts to comment and uncomment code?


There were Ctrl+E+C (comment) and Ctrl+E+U (uncomment) in older versions, or Ctrl+K+C and Ctrl+K+U.

But in Visual Studio 2012, I can't see key shortcuts:

enter image description here

How can I enable those shortcuts?


Solution

  • Keyboard accelerators are configurable. You can find out which keyboard accelerators are bound to a command in menu ToolsOptions on the EnvironmentKeyboard page.

    These commands are named Edit.CommentSelection and Edit.UncommentSelection.

    (With my settings, these are bound to Ctrl + K, Ctrl + C and Ctrl + K, Ctrl + U. I would guess that these are the defaults, at least in the C++ defaults, but I don't know for sure. The best way to find out is to check your settings.)