RubyMine 7.0.1 Web Help

Code blocks have folding toggles on the right edge of the gutter next to each block. When a block is folded, the toggle foldingPlus appears to the left of the first line of the block. When a block is expanded, the toggle foldingMinusStart is shown at the beginning of the block and foldingMinusEnd at its end.

Folding and expanding code blocks works for entire classes, method bodies, import lists, comments, HTML and XML tags

You can fold (collapse) and unfold (expand) code blocks by using:

  • Code folding toggles (foldingMinusStart, foldingMinusEnd or foldingPlus). These toggles are shown in the editor on the left of the corresponding blocks. If a block is unfolded, foldingMinusStart indicates the beginning of the block while foldingMinusEnd is located at its end. For folded blocks, the toggle is shown as foldingPlus.

    Note

    If you hold the Alt modifier and click a toggle button in the gutter, the code block will be collapsed or expanded recursively, i.e. all sub-blocks within the parent block will also be collapsed or expanded.

  • Commands of the Folding menu. The Folding menu can be accessed from the main menu bar (Code | Folding), or as a context menu in the editor.
  • Keyboard shortcuts. The corresponding shortcuts are shown in the Folding menu.

Folding menu

Item Shortcut Description
Expand Ctrl+NumPad+ or Ctrl+EqualsCtrl+NumPad+ or Ctrl+EqualsCtrl+NumPad+ or Ctrl+EqualsCtrl+NumPad+ or Ctrl+EqualsCtrl+NumPad+ or Ctrl+EqualsCtrl+NumPad+ or Ctrl+EqualsCtrl+NumPad+ or Ctrl+EqualsCtrl+NumPad+ or Ctrl+EqualsShift+F1⌘ NumPad or ⌘ Equals⌘ NumPad or ⌘ Equals⌘ NumPad or ⌘ Equals⌘ NumPad or ⌘ Equals Expand the current code block
Collapse Ctrl+NumPad - or Ctrl+MinusCtrl+NumPad - or Ctrl+MinusCtrl+NumPad - or Ctrl+MinusCtrl+NumPad - or Ctrl+MinusCtrl+NumPad - or Ctrl+MinusCtrl+NumPad - or Ctrl+MinusCtrl+NumPad - or Ctrl+MinusCtrl+NumPad - or Ctrl+MinusF1⌘ NumPad - or ⌘ Minus⌘ NumPad - or ⌘ Minus⌘ NumPad - or ⌘ Minus⌘ NumPad - or ⌘ Minus Collapse the current code block
Expand Recursively Ctrl+Alt+NumPad+ or Ctrl+Alt+EqualsCtrl+Alt+NumPad+ or Ctrl+Alt+EqualsCtrl+Alt+NumPad+ or Ctrl+Alt+EqualsCtrl+Alt+NumPad+ or Ctrl+Alt+EqualsCtrl+Alt+NumPad+ or Ctrl+Alt+EqualsCtrl+Alt+NumPad+ or Ctrl+Alt+EqualsCtrl+NumPad *Ctrl+Alt+NumPad+ or Ctrl+Alt+EqualsAlt+⌘+NumPad+ or Alt+⌘+EqualsAlt ⌘ NumPad or Alt ⌘ EqualsAlt ⌘ NumPad or Alt ⌘ EqualsAlt ⌘ NumPad or Alt ⌘ EqualsAlt ⌘ NumPad or Alt ⌘ Equals Expand all sub-blocks within the current code block
Collapse Recursively Ctrl+Alt+NumPad - or Ctrl+Alt+MinusCtrl+Alt+NumPad - or Ctrl+Alt+MinusCtrl+Alt+NumPad - or Ctrl+Alt+MinusCtrl+Alt+NumPad - or Ctrl+Alt+MinusCtrl+Alt+NumPad - or Ctrl+Alt+MinusCtrl+Alt+NumPad - or Ctrl+Alt+MinusCtrl+NumPad /Ctrl+Alt+NumPad - or Ctrl+Alt+MinusAlt+⌘+NumPad - or Alt+⌘+MinusAlt ⌘ NumPad - or Alt ⌘ MinusAlt ⌘ NumPad - or Alt ⌘ MinusAlt ⌘ NumPad - or Alt ⌘ MinusAlt ⌘ NumPad - or Alt ⌘ Minus Collapse all sub-blocks within the current code block
Expand All Ctrl+Shift+NumPad+ or Ctrl+Shift+EqualsCtrl+Shift+NumPad+ or Ctrl+Shift+EqualsCtrl+Shift+NumPad+ or Ctrl+Shift+EqualsCtrl+Shift+NumPad+ or Ctrl+Shift+EqualsCtrl+Shift+NumPad+ or Ctrl+Shift+EqualsCtrl+Shift+NumPad+ or Ctrl+Shift+EqualsCtrl+Shift+NumPad+ or Ctrl+Shift+EqualsCtrl+NumPad *Shift+Alt+⌘+0Shift ⌘ NumPad or Shift ⌘ EqualsShift ⌘ NumPad or Shift ⌘ Equals⌘ NumPad *Shift ⌘ NumPad or Shift ⌘ Equals Expand all code blocks in the selected area, or in the current file if no area is selected
Collapse All Ctrl+Shift+NumPad - or Ctrl+Shift+MinusCtrl+Shift+NumPad - or Ctrl+Shift+MinusCtrl+Shift+NumPad - or Ctrl+Shift+MinusCtrl+Shift+NumPad - or Ctrl+Shift+MinusCtrl+Shift+NumPad - or Ctrl+Shift+MinusCtrl+Shift+NumPad - or Ctrl+Shift+MinusCtrl+Shift+NumPad - or Ctrl+Shift+MinusCtrl+Shift+NumPad /Alt+⌘+0Shift ⌘ NumPad - or Shift ⌘ MinusShift ⌘ NumPad - or Shift ⌘ MinusShift ⌘ NumPad /Shift ⌘ NumPad - or Shift ⌘ Minus Collapse all code blocks in the selected area, or in the current file if no area is selected
Expand to level Ctrl+NumPad *, 1 or Ctrl+NumPad *, NumPad-1Ctrl+NumPad *, 1 or Ctrl+NumPad *, NumPad-1Ctrl+NumPad *, 1 or Ctrl+NumPad *, NumPad-1Ctrl+NumPad *, 1 or Ctrl+NumPad *, NumPad-1Ctrl+NumPad *, 1 or Ctrl+NumPad *, NumPad-1Ctrl+NumPad *, 1 or Ctrl+NumPad *, NumPad-1Ctrl+NumPad *, 1 or Ctrl+NumPad *, NumPad-1Ctrl+NumPad *, 1 or Ctrl+NumPad *, NumPad-1⌘+NumPad *, 1 or ⌘+NumPad *, NumPad-1⌘ NumPad *, 1 or ⌘ NumPad *, NumPad-1⌘ NumPad *, 1 or ⌘ NumPad *, NumPad-1⌘ NumPad *, 1 or ⌘ NumPad *, NumPad-1⌘ NumPad *, 1 or ⌘ NumPad *, NumPad-1
Ctrl+NumPad *, 2 or Ctrl+NumPad *, NumPad-2Ctrl+NumPad *, 2 or Ctrl+NumPad *, NumPad-2Ctrl+NumPad *, 2 or Ctrl+NumPad *, NumPad-2Ctrl+NumPad *, 2 or Ctrl+NumPad *, NumPad-2Ctrl+NumPad *, 2 or Ctrl+NumPad *, NumPad-2Ctrl+NumPad *, 2 or Ctrl+NumPad *, NumPad-2Ctrl+NumPad *, 2 or Ctrl+NumPad *, NumPad-2Ctrl+NumPad *, 2 or Ctrl+NumPad *, NumPad-2⌘+NumPad *, 2 or ⌘+NumPad *, NumPad-2⌘ NumPad *, 2 or ⌘ NumPad *, NumPad-2⌘ NumPad *, 2 or ⌘ NumPad *, NumPad-2⌘ NumPad *, 2 or ⌘ NumPad *, NumPad-2⌘ NumPad *, 2 or ⌘ NumPad *, NumPad-2
Ctrl+NumPad *, 3 or Ctrl+NumPad *, NumPad-3Ctrl+NumPad *, 3 or Ctrl+NumPad *, NumPad-3Ctrl+NumPad *, 3 or Ctrl+NumPad *, NumPad-3Ctrl+NumPad *, 3 or Ctrl+NumPad *, NumPad-3Ctrl+NumPad *, 3 or Ctrl+NumPad *, NumPad-3Ctrl+NumPad *, 3 or Ctrl+NumPad *, NumPad-3Ctrl+NumPad *, 3 or Ctrl+NumPad *, NumPad-3Ctrl+NumPad *, 3 or Ctrl+NumPad *, NumPad-3⌘+NumPad *, 3 or ⌘+NumPad *, NumPad-3⌘ NumPad *, 3 or ⌘ NumPad *, NumPad-3⌘ NumPad *, 3 or ⌘ NumPad *, NumPad-3⌘ NumPad *, 3 or ⌘ NumPad *, NumPad-3⌘ NumPad *, 3 or ⌘ NumPad *, NumPad-3
Ctrl+NumPad *, 4 or Ctrl+NumPad *, NumPad-4Ctrl+NumPad *, 4 or Ctrl+NumPad *, NumPad-4Ctrl+NumPad *, 4 or Ctrl+NumPad *, NumPad-4Ctrl+NumPad *, 4 or Ctrl+NumPad *, NumPad-4Ctrl+NumPad *, 4 or Ctrl+NumPad *, NumPad-4Ctrl+NumPad *, 4 or Ctrl+NumPad *, NumPad-4Ctrl+NumPad *, 4 or Ctrl+NumPad *, NumPad-4Ctrl+NumPad *, 4 or Ctrl+NumPad *, NumPad-4⌘+NumPad *, 4 or ⌘+NumPad *, NumPad-4⌘ NumPad *, 4 or ⌘ NumPad *, NumPad-4⌘ NumPad *, 4 or ⌘ NumPad *, NumPad-4⌘ NumPad *, 4 or ⌘ NumPad *, NumPad-4⌘ NumPad *, 4 or ⌘ NumPad *, NumPad-4
Ctrl+NumPad *, 5 or Ctrl+NumPad *, NumPad-5Ctrl+NumPad *, 5 or Ctrl+NumPad *, NumPad-5Ctrl+NumPad *, 5 or Ctrl+NumPad *, NumPad-5Ctrl+NumPad *, 5 or Ctrl+NumPad *, NumPad-5Ctrl+NumPad *, 5 or Ctrl+NumPad *, NumPad-5Ctrl+NumPad *, 5 or Ctrl+NumPad *, NumPad-5Ctrl+NumPad *, 5 or Ctrl+NumPad *, NumPad-5Ctrl+NumPad *, 5 or Ctrl+NumPad *, NumPad-5⌘+NumPad *, 5 or ⌘+NumPad *, NumPad-5⌘ NumPad *, 5 or ⌘ NumPad *, NumPad-5⌘ NumPad *, 5 or ⌘ NumPad *, NumPad-5⌘ NumPad *, 5 or ⌘ NumPad *, NumPad-5⌘ NumPad *, 5 or ⌘ NumPad *, NumPad-5
Expand the selected code block to a certain level
Expand all to level Ctrl+Shift+NumPad *, 1 or Ctrl+Shift+NumPad *, NumPad-1Ctrl+Shift+NumPad *, 1 or Ctrl+Shift+NumPad *, NumPad-1Ctrl+Shift+NumPad *, 1 or Ctrl+Shift+NumPad *, NumPad-1Ctrl+Shift+NumPad *, 1 or Ctrl+Shift+NumPad *, NumPad-1Ctrl+Shift+NumPad *, 1 or Ctrl+Shift+NumPad *, NumPad-1Ctrl+Shift+NumPad *, 1 or Ctrl+Shift+NumPad *, NumPad-1Ctrl+Shift+NumPad *, 1 or Ctrl+Shift+NumPad *, NumPad-1Ctrl+Shift+NumPad *, 1 or Ctrl+Shift+NumPad *, NumPad-1Alt+⌘+NumPad *, 1 or Alt+⌘+NumPad *, NumPad-1Alt ⌘ NumPad *, 1 or Alt ⌘ NumPad *, NumPad-1Alt ⌘ NumPad *, 1 or Alt ⌘ NumPad *, NumPad-1Alt ⌘ NumPad *, 1 or Alt ⌘ NumPad *, NumPad-1Alt ⌘ NumPad *, 1 or Alt ⌘ NumPad *, NumPad-1
Ctrl+Shift+NumPad *, 2 or Ctrl+Shift+NumPad *, NumPad-2Ctrl+Shift+NumPad *, 2 or Ctrl+Shift+NumPad *, NumPad-2Ctrl+Shift+NumPad *, 2 or Ctrl+Shift+NumPad *, NumPad-2Ctrl+Shift+NumPad *, 2 or Ctrl+Shift+NumPad *, NumPad-2Ctrl+Shift+NumPad *, 2 or Ctrl+Shift+NumPad *, NumPad-2Ctrl+Shift+NumPad *, 2 or Ctrl+Shift+NumPad *, NumPad-2Ctrl+Shift+NumPad *, 2 or Ctrl+Shift+NumPad *, NumPad-2Ctrl+Shift+NumPad *, 2 or Ctrl+Shift+NumPad *, NumPad-2Alt+⌘+NumPad *, 2 or Alt+⌘+NumPad *, NumPad-2Alt ⌘ NumPad *, 2 or Alt ⌘ NumPad *, NumPad-2Alt ⌘ NumPad *, 2 or Alt ⌘ NumPad *, NumPad-2Alt ⌘ NumPad *, 2 or Alt ⌘ NumPad *, NumPad-2Alt ⌘ NumPad *, 2 or Alt ⌘ NumPad *, NumPad-2
Ctrl+Shift+NumPad *, 3 or Ctrl+Shift+NumPad *, NumPad-3Ctrl+Shift+NumPad *, 3 or Ctrl+Shift+NumPad *, NumPad-3Ctrl+Shift+NumPad *, 3 or Ctrl+Shift+NumPad *, NumPad-3Ctrl+Shift+NumPad *, 3 or Ctrl+Shift+NumPad *, NumPad-3Ctrl+Shift+NumPad *, 3 or Ctrl+Shift+NumPad *, NumPad-3Ctrl+Shift+NumPad *, 3 or Ctrl+Shift+NumPad *, NumPad-3Ctrl+Shift+NumPad *, 3 or Ctrl+Shift+NumPad *, NumPad-3Ctrl+Shift+NumPad *, 3 or Ctrl+Shift+NumPad *, NumPad-3Alt+⌘+NumPad *, 3 or Alt+⌘+NumPad *, NumPad-3Alt ⌘ NumPad *, 3 or Alt ⌘ NumPad *, NumPad-3Alt ⌘ NumPad *, 3 or Alt ⌘ NumPad *, NumPad-3Alt ⌘ NumPad *, 3 or Alt ⌘ NumPad *, NumPad-3Alt ⌘ NumPad *, 3 or Alt ⌘ NumPad *, NumPad-3
Ctrl+Shift+NumPad *, 4 or Ctrl+Shift+NumPad *, NumPad-4Ctrl+Shift+NumPad *, 4 or Ctrl+Shift+NumPad *, NumPad-4Ctrl+Shift+NumPad *, 4 or Ctrl+Shift+NumPad *, NumPad-4Ctrl+Shift+NumPad *, 4 or Ctrl+Shift+NumPad *, NumPad-4Ctrl+Shift+NumPad *, 4 or Ctrl+Shift+NumPad *, NumPad-4Ctrl+Shift+NumPad *, 4 or Ctrl+Shift+NumPad *, NumPad-4Ctrl+Shift+NumPad *, 4 or Ctrl+Shift+NumPad *, NumPad-4Ctrl+Shift+NumPad *, 4 or Ctrl+Shift+NumPad *, NumPad-4Alt+⌘+NumPad *, 4 or Alt+⌘+NumPad *, NumPad-4Alt ⌘ NumPad *, 4 or Alt ⌘ NumPad *, NumPad-4Alt ⌘ NumPad *, 4 or Alt ⌘ NumPad *, NumPad-4Alt ⌘ NumPad *, 4 or Alt ⌘ NumPad *, NumPad-4Alt ⌘ NumPad *, 4 or Alt ⌘ NumPad *, NumPad-4
Ctrl+Shift+NumPad *, 5 or Ctrl+Shift+NumPad *, NumPad-5Ctrl+Shift+NumPad *, 5 or Ctrl+Shift+NumPad *, NumPad-5Ctrl+Shift+NumPad *, 5 or Ctrl+Shift+NumPad *, NumPad-5Ctrl+Shift+NumPad *, 5 or Ctrl+Shift+NumPad *, NumPad-5Ctrl+Shift+NumPad *, 5 or Ctrl+Shift+NumPad *, NumPad-5Ctrl+Shift+NumPad *, 5 or Ctrl+Shift+NumPad *, NumPad-5Ctrl+Shift+NumPad *, 5 or Ctrl+Shift+NumPad *, NumPad-5Ctrl+Shift+NumPad *, 5 or Ctrl+Shift+NumPad *, NumPad-5Alt+⌘+NumPad *, 5 or Alt+⌘+NumPad *, NumPad-5Alt ⌘ NumPad *, 5 or Alt ⌘ NumPad *, NumPad-5Alt ⌘ NumPad *, 5 or Alt ⌘ NumPad *, NumPad-5Alt ⌘ NumPad *, 5 or Alt ⌘ NumPad *, NumPad-5Alt ⌘ NumPad *, 5 or Alt ⌘ NumPad *, NumPad-5
Expand all code blocks in the current file to a certain level
Expand doc comments N/A Expand all documentation comments in the current file
Collapse doc comments N/A Collapse all documentation comments in the current file
Fold Selection / Remove region Ctrl+PeriodCtrl+PeriodCtrl+PeriodCtrl+PeriodCtrl+PeriodCtrl+PeriodCtrl+PeriodCtrl+Period⌘+Period⌘ Period⌘ Period⌘ Period⌘ Period Collapse the selected fragment / Expand the selected fragment and make it "unfoldable"

See Also

Reference:

Web Resources: