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?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityIn 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?
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.
ALT + LMC
and subsequently //
works in .scala
as well. To uncomment: ALT + LMC
and subsequently two times DEL
Ctrl+Q
is faster than multiline select and //
CTRL+Q
didn't work, you have to choose the lanuage of your file from the language menu
, otherwise notepad++ will not know what is the comment type you want.
Feb 7, 2017 at 18:44
C++
code with one of those selected lines being // This is amazing code!
. Now that line will be converted to This is amazing code!
. The feature is "doing what it says on the tin", just not what was expected! Personally, I'd expect that if >50% of selected lines were not commented then comment them all, and vice versa.
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.
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.
.html
file and executing the command results in <!-- -->
, but nothing happens in a .scala
file
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.
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 :
place the cursor in your doc and type:
//
Macro > Stop recording
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.
langs.xml
and try again.