23

I can comment lines easily enough with Ctrl+Shift+Q. How do I uncomment the lines? Ctrl+Shift+K doesn't do it.

4 Answers 4

23

If you have the XML Tools plug-in, you can use the following shortcuts for block commenting/uncommenting:

  • Ctrl+Alt+Shift+C — comment selection

  • Ctrl+Alt+Shift+R — uncomment selection.

As for the Ctrl+Shift+K shortcut not working, you should probably report the problem to the Notepad++ developer.

Edit: Looks like the standard Block comment (Ctrl+K), Block uncomment (Ctrl+Shift+K) and Toggle block comment (Ctrl+Q) commands don't work with XML at all. (I'm using v. 5.5 by the way.)

4
  • Maybe Ctrl+Shift+k has been remapped.
    – alex
    Commented Sep 21, 2009 at 20:11
  • No, I haven't found any other command with this shortcut assigned. The appropriate menu command (Edit -> Comment/Uncomment -> Block uncomment) also doesn't work, so it must be a problem with Notepad++.
    – Helen
    Commented Sep 22, 2009 at 16:15
  • 1
    For me, Ctrl + Alt + Shift + R was dual mapped to "Launch in Chrome". I ended up deleting that shortcut since I'll use it far less often. Commented Jul 13, 2011 at 14:10
  • Very useful plugin - works fine on v 5.9.3, except when you alt-select columns of text.
    – CAD bloke
    Commented Aug 23, 2011 at 22:35
24

The Notepad++ comment/uncomment functionality is not really intuitive. Here's a list of the comment shortcuts and related operations that Notepad++ provides:

  • Ctrl-Q
    Toggle line comment on current line / selection

  • Ctrl-Shift-Q
    Create block comment on current line / selection (no toggle!)

  • Ctrl-K
    Create line comment on current line / selection

  • Ctrl-Shift-K
    Remove line comment from current line / selection

Now, since XML only has block comments and no line comments, the only way to create a comment is to use Ctrl-Shift-Q and there is no way to remove a comment as Notepad++ does not provide a Remove block comment feature.

Igor

3
  • Still true in V 5.9.3
    – CAD bloke
    Commented Aug 23, 2011 at 22:17
  • Looks like there's a block uncomment feature now (6.8.8), but there's no default shortcut key. Commented Jan 11, 2016 at 15:21
  • 1
    Ctrl-Shift-K works only when the cursor is inside an xml element.
    – WhiteN01se
    Commented Sep 12, 2017 at 19:40
2

Ctrl-Q uncomment on current line / selection

Ctrl-K comment on current line / selection

1
  • 2
    Why did you copy/paste (partially) previous answer?
    – Toto
    Commented Sep 30, 2019 at 18:27
1

I had the situation to remote comments from a properties / ini file.

used the reg expression ^.#.$ to search and replace with blank (see here http://www.shareaschnitzel.com/delete-a-line-containing-certain-string-or-text/ )

next steps remote blank lines.

This might help you to remove comment from a text file

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .