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 | Ctrl+NumPad - | Collapse the foldable block where your caret is.. |
Expand | Ctrl+NumPad + | Expand the collapsed block under the caret. |
Collapse Recursively | Ctrl+Alt+NumPad - | Collapse the current foldable block and all foldable blocks within it. |
Expand Recursively | Ctrl+Alt+NumPad + | Expand the collapsed block under the caret all the collapsed blocks within it. |
Expand All | Ctrl+Shift+NumPad + | Expand all collapsed blocks in the document or within the selection. |
Collapse All | Ctrl+Shift+NumPad - | 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 | Ctrl+. | 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. |