Code folding
CLion automatically recognizes certain code structures and makes them foldable. You can also define custom folding regions.
Folded code fragments are shown as shaded ellipses (). If a folded code fragment has errors, CLion highlights the fragment in red.
For more information, refer to Code folding.
Command | Shortcut | Description |
---|---|---|
Collapse | Collapse the foldable block where your caret is.. | |
Expand | Expand the collapsed block under the caret. | |
Collapse Recursively | Collapse the current foldable block and all foldable blocks within it. | |
Expand Recursively | Expand the collapsed block under the caret all the collapsed blocks within it. | |
Expand All | Expand all collapsed blocks in the document or within the selection. | |
Collapse All | Collapse all foldable blocks in the document or within the selection. | |
Expand all to level | 1, 2, 3, 4 or 5 | Expand all the folded blocks in the document up to the specified nesting level. | |
Fold Selection / Remove region | Collapse the selected fragment and create a custom folding region for it to make it 'foldable' or expand the current fragment and remove the corresponding custom folding region. |