Commenting

When programming, it is often useful to comment (adding certain tags around or in front of text to mark it is non-code) or uncomment (large) section of text. Notepad++ allows to add two types of comments:

  • block comments, which means adding a special tag in front of each line of (selected) text.
  • stream comments, which means putting special tags around the selected text.

Notepad++ can also remove block comments from text, or toggle them (adding them where absent and removing them where present). These options are available from the Edit menu or the Context Menu (see the section about the Context Menu for more details).

 

  • To add block comment tags, select Edit->Comment/Uncomment->Block comment.
  • To remove block comment tags, select Edit->Comment/Uncomment->Block uncomment.
  • To Toggle tags for all selected lines, select Edit->Comment/Uncomment->Block toggle comment
  • To add stream comment tags around the selected text, select Edit->Comment/Uncomment->Stream comment.

Note that if a block comment starts in column 1, and you toggle block comment on a range of lines that contains the line, the line will be uncommented, which is not usually desired. This behaviour is difficult to avoid.

X
Loading