# Folding

Notepad++ supports so called folding for your text documents. This means that certain lines of your text can be hidden based on certain traits. This works well for structured languages such as C++ or XML . Blocks of texts are 'parented' to others and by folding them (also called collapsing) only the first line is visible. This works well if you want a quick glance at your document and skim for a relevant position. Unfolding the text (a.k.a. Expanding or Uncollapsing) shows the text again.

You can recognize text that can be folded by looking at the fold margin on the left. This margin shows icons and line to indicate the structure of the text (the appearance of the margin can be changed, see Styler Configurator and Preferences). The current lexer determines the structure (see Languages). By default, the fold margin shows boxes and lines to indicate the structure. A box with a minus sign () indicates the text can be collapsed. Inversely, a box with a plus sign () indicates the text can be expanded. Folded text is additionally indicated with a horizontal line where the text is collapsed. The first line of the collapsed text will always remain visible. Lines on the fold margin indicate that the textlines they run by are foldable. Vertical lines () indicate multiple lines that can be folded together as a group, which is terminated with a small horizontal line() or a box.

Rhe images shown above are from the default style, one among the 4 supported. Also, you may decide to hide the margin completely, even when the language of the document allows for folding.

There are multiple ways to fold text.

- The foremost means is by clicking with the left mouse button on a box with a minus sign. This will simply collapse all the text that is in this group.
- The same procedure but with the Ctrl key pressed down will cause the group to collapse, but also any sub groups inside. This effectively means that if you were to unfold just that group, all subgroups would still be folded.
- Using the menu:
  View->Fold All will fold every single group in the document, causing the minimal amount of text visible. View->Collapse current level will only collapse the current group (that is, the group that contains the current line, anywhere in the group). This will not collapse any subgroups. View->Collapse level... will collapse the selected level (ranging from 1 to 8). This will collapse all the groups on a particular level, but not any subgroups. You can use this to view your text with a certain 'level of detail'.

To unfold folded text, use any of the following measures: p>

- Click on the box with the plus sign in the fold margin, this will expand that group.
- Click on the box with the plus sign with the Shift or Ctrl key pressed down. This will expand the group and any folded subgroups.
- Using the menu:
  View->Unfold All will expand every single group in the document, this will cause the maximum amount of text to be visible. View->Uncollapse current level will only expand the current group (that is, the group that contains the current line). This will not collapse any subgroups. View->Uncollapse level... will make every group of a certain level visible, including any parenting group.

Also note that if any change occurs in folded text, it will automatically unfold to show the text.