/www/tags/NOV_07_2009/htdocs/42docs/users-guide/folding.html
HTML | 164 lines | 160 code | 4 blank | 0 comment | 0 complexity | f958da1dd23eac4f19a55db96b8e88a6 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
- <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Folding</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="jEdit 4.2 User's Guide"><link rel="up" href="source-edit.html" title="Chapter 6. Editing Source Code"><link rel="previous" href="abbrevs.html" title="Abbreviations"><link rel="next" href="customizing.html" title="Chapter 7. Customizing jEdit"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Folding</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="abbrevs.html">Prev</a> </td><th width="60%" align="center">Chapter 6. Editing Source Code</th><td width="20%" align="right"> <a accesskey="n" href="customizing.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="folding"></a>Folding</h2></div></div><div></div></div><p>
- Program source code and other structured text files can be thought of
- as containing a hierarchy of sections, which themselves might contain sub-sections.
- The folding feature lets you selectively hide and show these sections,
- replacing hidden ones with a single line that serves as an
- “<span class="quote">overview</span>” of that section.
- Folding is disabled by default. To enable it, you must choose one of the
- available folding modes.
- </p><p>
- “<span class="quote">Indent</span>”
- mode creates folds based on a line's leading whitespace; the more
- leading whitespace a block of text has, the further down it is
- in the hierarchy. For example:
- </p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="screen">This is a section
- This is a sub-section
- This is another sub-section
- This is a sub-sub-section
- Another top-level section</pre></td></tr></table><p>
- “<span class="quote">Explicit</span>” mode folds away blocks of
- text surrounded with “<span class="quote">{{{</span>” and “<span class="quote">}}}</span>”.
- For example:
- </p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="screen">{{{ The first line of a fold.
- When this fold is collapsed, only the above line will be visible.
- {{{ A sub-section.
- With text inside it.
- }}}
- {{{ Another sub-section.
- }}}
- }}}</pre></td></tr></table><p>
- Both modes have distinct advantages and disadvantages; indent folding
- requires no changes to be made to a buffer's text and does a decent
- job with most program source. Explicit folding requires “<span class="quote">fold
- markers</span>” to be inserted into the text, but is more flexible in
- exactly what to fold away.
- </p><p>
- Some plugins might add additional folding modes; see
- <a href="using-plugins.html" title="Chapter 9. Installing and Using Plugins">Chapter 9, <i>Installing and Using Plugins</i></a> for information about plugins.
- </p><p>
- Folding can be enabled in one of several ways:
- </p><div class="itemizedlist"><ul type="disc"><li><p>On a global or mode-specific
- basis in the <span><b class="guibutton">Editing</b></span> pane
- of the <span><b class="guimenu">Utilities</b></span>><span><b class="guimenuitem">Global
- Options</b></span> dialog box. See <a href="global-opts.html#editing-pane" title="The Editing Pane">the section called “The Editing Pane”</a>.</p></li><li><p>In the current buffer for the duration of the editing
- session in the
- <span><b class="guimenu">Utilities</b></span>><span><b class="guimenuitem">Buffer Options</b></span>
- dialog box. See <a href="buffer-opts.html" title="The Buffer Options Dialog Box">the section called “The Buffer Options Dialog Box”</a>.</p></li><li><p>In the current buffer for future editing sessions
- by placing the following in the first or last 10 lines of a buffer,
- where <i class="replaceable"><tt>mode</tt></i> is either “<span class="quote">indent</span>”,
- “<span class="quote">explicit</span>”, or the name of a plugin folding mode:
- </p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="screen">:folding=<i class="replaceable"><tt>mode</tt></i>:</pre></td></tr></table></li></ul></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>
- When using indent folding, portions of the buffer may become
- inaccessible if you change the leading indent of the first line of a
- collapsed fold. If you experience this, you can use the
- <span><b class="guimenuitem">Expand All Folds</b></span> command to make the text
- visible again.
- </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2607804"></a>Collapsing and Expanding Folds</h3></div></div><div></div></div><p>
- The first line of each fold has a triangle
- drawn next to it in the gutter (see <a href="overview.html" title="Interface Overview">the section called “Interface Overview”</a> for
- more information about the gutter). The triangle points toward the
- line when the fold is collapsed, and downward when the fold is
- expanded.
- Clicking the triangle collapses and
- expands the fold. To expand all sub-folds as well, hold down the
- <tt class="keycap">Shift</tt> while clicking.
- </p><p>
- The first line of a collapsed fold is drawn
- with a background color that depends on the fold level, and the number of
- lines in the fold is shown to the right of the line's text.
- </p><p>
- Folds can also be collapsed and expanded using menu item commands and
- keyboard shortcuts.
- </p><p>
- <span><b class="guisubmenu">Folding</b></span>><span><b class="guimenuitem">Collapse
- Fold</b></span> (shortcut: <tt class="keycap">A+BACK_SPACE</tt>)
- collapses the fold
- containing the caret.
- </p><p>
- <span><b class="guisubmenu">Folding</b></span>><span><b class="guimenuitem">Expand
- Fold One Level</b></span> (shortcut: <tt class="keycap">A+ENTER</tt>)
- expands the
- fold containing the caret. Nested folds will remain collapsed,
- and the caret will be positioned on the first nested fold (if any).
- </p><p>
- <span><b class="guisubmenu">Folding</b></span>><span><b class="guimenuitem">Expand
- Fold Fully</b></span> (shortcut: <tt class="keycap">AS+ENTER</tt>)
- expands the fold
- containing the caret, also expanding any nested folds.
- </p><p>
- <span><b class="guisubmenu">Folding</b></span>><span><b class="guimenuitem">Collapse
- All Folds</b></span> (shortcut: <tt class="keycap">C+e c</tt>)
- collapses all folds in the buffer.
- </p><p>
- <span><b class="guisubmenu">Folding</b></span>><span><b class="guimenuitem">Expand
- All Folds</b></span> (shortcut: <tt class="keycap">C+e x</tt>)
- expands all folds in the buffer.
- </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2607928"></a>Navigating Around With Folds</h3></div></div><div></div></div><p>
- <span><b class="guisubmenu">Folding</b></span>><span><b class="guimenuitem">Go to Parent
- Fold</b></span> (shortcut: <tt class="keycap">C+e u</tt>) moves
- the caret to the fold containing the one at the caret position.
- </p><p>
- <span><b class="guisubmenu">Folding</b></span>><span><b class="guimenuitem">Go to Previous
- Fold</b></span> (shortcut: <tt class="keycap">A+UP</tt>) moves
- the caret to the fold immediately before the caret position.
- </p><p>
- <span><b class="guisubmenu">Folding</b></span>><span><b class="guimenuitem">Go to Next
- Fold</b></span> (shortcut: <tt class="keycap">A+DOWN</tt>) moves
- the caret to the fold immediately after the caret position.
- </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2608059"></a>Miscellaneous Folding Commands</h3></div></div><div></div></div><p>
- <span><b class="guisubmenu">Folding</b></span>><span><b class="guimenuitem">Add
- Explicit Fold</b></span> (shortcut: <tt class="keycap">C+e a</tt>)
- surrounds the
- selection with “<span class="quote">{{{</span>” and “<span class="quote">}}}</span>”. If the
- current buffer's edit mode defines comment strings (see
- <a href="commenting.html" title="Commenting Out Code">the section called “Commenting Out Code”</a>) the explicit fold markers will
- automatically be commented out as well.
- </p><p>
- <span><b class="guisubmenu">Folding</b></span>><span><b class="guimenuitem">Select
- Fold</b></span>
- (shortcut: <tt class="keycap">C+e s</tt>)
- selects all lines within the fold containing the caret.
- <tt class="keycap">Control</tt>-clicking a fold expansion triangle
- in the gutter has the same effect.
- </p><p>
- <span><b class="guisubmenu">Folding</b></span>><span><b class="guimenuitem">Expand
- Folds With Level</b></span> (shortcut:
- <tt class="keycap">C+e ENTER <i class="replaceable"><tt>key</tt></i></tt>)
- reads the next character entered at the keyboard, and
- expands folds in the buffer
- with a fold level less than that specified, while collapsing all others.
- </p><p>
- Sometimes it is desirable to have files open with folds initially
- collapsed. This can be configured as follows:
- </p><div class="itemizedlist"><ul type="disc"><li><p>On a global or mode-specific
- basis in the <span><b class="guibutton">Editing</b></span> pane
- of the <span><b class="guimenu">Utilities</b></span>><span><b class="guimenuitem">Global
- Options</b></span> dialog box. See <a href="global-opts.html#editing-pane" title="The Editing Pane">the section called “The Editing Pane”</a>.</p></li><li><p>In the current buffer for future editing sessions
- by placing the following in the first or last 10 lines of a buffer,
- where <i class="replaceable"><tt>level</tt></i> is the desired fold level:
- </p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="screen">:collapseFolds=<i class="replaceable"><tt>level</tt></i>:</pre></td></tr></table></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="narrowing"></a>Narrowing</h3></div></div><div></div></div><p>
- The narrowing feature temporarily “<span class="quote">narrows</span>” the display
- of a buffer to a specified region. Text outside the region is not
- shown, but is still present in the buffer.
- </p><p>
- Holding down <tt class="keycap">Alt</tt> while clicking a fold expansion triangle in the gutter will hide all lines the buffer except
- those contained in the clicked fold.
- </p><p>
- <span><b class="guisubmenu">Folding</b></span>><span><b class="guimenuitem">Narrow
- Buffer to Fold</b></span> (shortcut: <tt class="keycap">C+e n n</tt>)
- hides all lines the buffer except
- those in the fold containing the caret.
-
- </p><p>
- <span><b class="guisubmenu">Folding</b></span>><span><b class="guimenuitem">Narrow
- Buffer to Selection</b></span> (shortcut: <tt class="keycap">C+e n s</tt>)
- hides all lines the buffer
- except those in the selection.
- </p><p>
- <span><b class="guisubmenu">Folding</b></span>><span><b class="guimenuitem">Expand
- All Folds</b></span> (shortcut: <tt class="keycap">C+e x</tt>)
- shows lines that were hidden as a result of narrowing.
- </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="abbrevs.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="source-edit.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="customizing.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Abbreviations </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 7. Customizing jEdit</td></tr></table></div></body></html>