98

In Eclipse it is possible to comment out multiple lines at once by selecting them and executing CTRL + /:

// helloworld

Is this possible in Notepad++ as well instead of typing /+/ in front of each individual line?

030
  • 2,808
  • 9
  • 29
  • 40

5 Answers5

122

Select desired lines and then press CTRL+Q. This will toggle comments on and off.

Also, I've just recently become a fan of ALT + Left Mouse Click to select multiple lines and just manually comment those lines with //.

I've found the ALT + Left Mouse Click trick to work well with Visual Studio, JetBrain products, Notepad++ but not Eclipse.

tvl
  • 145
VitaminYes
  • 1,703
31

Also CTRL+K works well in Notepad++ to comment. If you had existing comments in a long block you are commenting, CTRL+Q will uncomment your actual comments, where CTRL+K just add another level of // in front. CTRL+SHIFT+K removes a single line comment from the selection.

030
  • 2,808
  • 9
  • 29
  • 40
14

In notepad++ I believe that the shortcut is CTRL+Q for commenting the code.

You can go to Settings > Shortcut Mapper to change this to match your preference.

The default for a block comment is CTRL+SHIFT+Q. So you can highlight the block of code then use this shortcut.

Dan Smith
  • 633
0

If you prefer only using the mouse, install the "Customize Toolbar" plugin from the plugin manager, and add "Single Line Comment" and "Single Line Uncomment" buttons.

0

An alternative is to use a macro with a custom shortcut (CTRL+Q didn't work on javascript inside a .html document)

The trick works for a single line comment only.

Create the macro :

  1. Macro > Start recording
  2. place the cursor in your doc and type: //

  3. Macro > Stop recording

  4. Macro > Save
  5. Give a name and select your prefered keyboard shortcut.

To quickly comment a line :

Place the cursor at the beginning of the line to comment and press the shortcut you defined for the macro.

pit
  • 171