Skip to content

Code folding

Collapse and expand structured regions of a file — functions, blocks, classes and other language constructs — so you can focus on one part and hide the rest.

Using it

  • Fold markers ([+] / [−]) appear in a margin next to foldable lines. Click one to collapse or expand that region.
  • A collapsed region shows as a single header line with a separator drawn beneath it; expanding restores the hidden lines.
  • Jumping to a hidden line (go-to-line, a search hit, a bookmark) automatically reveals it.

Commands

View menu:

Command Shortcut
Toggle Fold (the region at the caret) Ctrl+Alt+F (⌥⌘← on macOS)
Fold All Ctrl+Alt+Shift+F
Unfold All Ctrl+Alt+Shift+U

Needs a language

Folding follows the document's language structure, so the fold margin appears once a syntax colorizer is active for the file. Plain, unrecognised text has no fold regions.