4

I want to know if it is possible to comment and uncomment text blocks in Visual Studio with a single command.

I'm used to just press Ctrl + / to toggle between comment and uncomment text blocks, because I've been using IntelliJ IDEA.

But in Visual Studio you have to press:
Ctrl + k + c to comment code, and
Ctrl + k + u to uncomment code.

Is there any way to comment / uncomment your code in Visual Studio with a single command just like in IntelliJ IDEA?

2 Answers 2

5

Actually yes, there is a way.

  • Go to Tools -> Options... in the menu
  • Select Environment -> Keyboard from the options list
  • Find / Show Edit.ToggleLineComment in the keyboard commands list

Options — Environment -> Keyboard — Edit.ToggleLineComment

Here you can setup how to comment / uncomment a single or even multiple lines with a single keyboard shortcut.

Sign up to request clarification or add additional context in comments.

Comments

3

You can actually follow this path Tools -> Options -> Environment -> Keyboard and change the drop-down selection on your top right to Visual Studio Code. This will allow you to use the Visual Studio Code keyboard bindings such as CTRL+/ to comment/uncomment.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.