85. toggleCollapsed

Parameter syntax:

[ 'toggle'|'collapse'|'expand'|'collapseAll'|'expandAll'
  [ '+' 'toggle'|'collapse'|'expand'|'collapseAll'|'expandAll']? ]?

Changes the state of the nearest collapsible view.

The ``nearest collapsible view'' is searched like this:

The parameter of this command specifies up to two operations. The default operation is toggle. Supported operations are:

toggle

Collapses nearest collapsible view if it is expanded and expands nearest collapsible view if it is collapsed.

collapse

Collapses nearest collapsible view if it is expanded; otherwise has no effect.

expand

Expands nearest collapsible view if it is collapsed; otherwise has no effect.

collapseAll

Collapses nearest collapsible view and then, recursively collapses all its collapsible descendant views.

expandAll

Expands nearest collapsible view and then, recursively expands all its collapsible descendant views.

Recommended bindings (found in the add-on called "A sample customize.xxe" — download and install it using OptionsInstall Add-ons):

  <binding>
    <keyPressed code="ESCAPE" />
    <charTyped char="/" />
    <command name="toggleCollapsed" />
  </binding>

  <binding>
    <keyPressed code="ESCAPE" />
    <charTyped char="+" />
    <command name="toggleCollapsed" parameter="expandAll" />
  </binding>

  <binding>
    <keyPressed code="ESCAPE" />
    <charTyped char="-" />
    <command name="toggleCollapsed" parameter="collapseAll" />
  </binding>

  <binding>
    <keyPressed code="ESCAPE" />
    <charTyped char="1" />
    <command name="toggleCollapsed" parameter="collapseAll+expand" />
  </binding>