Notepad++ current supports folding as described here:


However, I see no immediate way to actually select or copy the actual foldings that you can collapse. In essence, I would like to move this collapsed group to a different section of my document, and although a brute force scroll-down select is possible, it seems entirely inefficient since Notepad++ already identifies this group.

Is what I am asking possible? I saw some other posts related to folding, but they were not actually interested in saving the contents within the collapsed group.


2 Answers 2


Let me give you an example:

this is the first line of code  |
{ <-- this is your collapsed code
 | Last line of code

Select from the end of the first line of code (|) to the beginning of the last line of code (|). Copy and paste wherever you need.

  • 1
    This worked. I feel a bit silly for not considering this. Previously, I had attempted copying the line with the collapsed code only. Copying from the end of the line directly above the collapsed code to the beginning of the line directly below did appropriately select the box.
    – Jake Z
    Jul 3, 2012 at 19:33
  • No problem! I read your question and I actually had to open up my NotePad++ to try it.
    – Rhyuk
    Jul 3, 2012 at 20:54

First of all, what programming language are you using? I know that this can be done when writing C (and I'm assuming it's also true for other C-like languages), but it's definitely easier when using a certain coding style than for others.

Specifically, the program folds code such that the opening { is the last thing visible. If you write a block like this:

if (something) {
} else {

the entire block will be folded up at the same time and only the if line is visible. If you instead write a block like this:

if (something)

the if and else halves will fold up separately. The { for each half will be on a line by itself. If you select from the line containing the { character to the first character on the following like, you will effectively select everything within that collapsed section. It's possible to do this using the first code style I demonstrated, but it's a bit more difficult (you can copy the entire block, but not just one branch of the if).

Keyboard Shortcut Remember that when the cursor is on a curly brace, Ctrl+B will jump to the matching brace. If you hold the Shift key down when you do this, you will highlight everything in between the braces as well.

  • The second style will work much better, but that was not quite the issue I had. I appreciate the response.
    – Jake Z
    Jul 3, 2012 at 19:34
  • @MarkWinter- I edited my answer to include a keyboard shortcut for doing this that you may find useful.
    – bta
    Jul 3, 2012 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.