Fold VS Code regions without forgetting what is hidden
Option-Command-[ folds a region and Option-Command-] unfolds it. Folding changes visibility, not which code exists in the file.
- Scope
- Visual Studio Code · Current vendor documentation checked 3 November 2026; no running-app compatibility test is claimed.
- Keyboard and customization
- Documented Mac defaults; punctuation and function keys depend on keyboard layout and hardware.. User bindings, app versions, focused controls and installed extensions can change a command. Inspect the active app menu or its shortcut editor when a listed combination differs.
- Review basis
- Documentation reviewed 2026-11-03 by Codex — primary-documentation and editorial review; no hands-on runtime test. These bindings were not tested in a running app for this guide.
Use folding to focus a reading task
Collapsing unrelated regions can make a long file easier to scan while you investigate one function or section. Choose the region around the cursor deliberately and inspect the fold indicator. Hidden code still exists and can still affect the program, so do not infer that a collapsed part is inactive or irrelevant.
Distinguish one region from the whole file
The single-region commands are useful for a local reading task. Fold All and Unfold All act more broadly. If the file suddenly looks much shorter than expected, inspect the folding state before assuming content was deleted. Language support and indentation can affect which regions the editor recognises.
Return to an expanded review before editing widely
After using a folded view to orient yourself, expand the regions relevant to the planned change. Review hidden surrounding code before applying a larger replacement or moving a block. Practise the fold-and-unfold pair on a harmless file so the visual state is easy to recognise.
Documented commands for this workflow
Scroll the table sideways to see every column.
Sources and corrections
- Default keyboard shortcuts — Visual Studio Code — checked 2026-11-03
- Basic editing — Visual Studio Code — checked 2026-11-03
Found a mismatch? Email pashaseenainc@gmail.com with your app version, macOS version, keyboard layout and the command. Please leave personal document names out.
Keep going
Right there when you need it.
Keep a compact shortcut reference in your Mac’s menu bar.
Explore the native Mac app