PageRenderTime 76ms CodeModel.GetById 57ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms


HTML | 164 lines | 160 code | 4 blank | 0 comment | 0 complexity | f958da1dd23eac4f19a55db96b8e88a6 MD5 | raw file
  1<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>
  2   Program source code and other structured text files can be thought of
  3   as containing a hierarchy of sections, which themselves might contain sub-sections.
  4   The folding feature lets you selectively hide and show these sections,
  5   replacing hidden ones with a single line that serves as an
  6   &#8220;<span class="quote">overview</span>&#8221; of that section.
  7   Folding is disabled by default. To enable it, you must choose one of the
  8   available folding modes.
  9  </p><p>
 10  &#8220;<span class="quote">Indent</span>&#8221;
 11   mode creates folds based on a line's leading whitespace; the more
 12   leading whitespace a block of text has, the further down it is
 13   in the hierarchy. For example:
 14  </p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="screen">This is a section
 15  This is a sub-section
 16  This is another sub-section
 17    This is a sub-sub-section
 18Another top-level section</pre></td></tr></table><p>
 19   &#8220;<span class="quote">Explicit</span>&#8221; mode folds away blocks of
 20   text surrounded with &#8220;<span class="quote">{{{</span>&#8221; and &#8220;<span class="quote">}}}</span>&#8221;.
 21   For example:
 22  </p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="screen">{{{ The first line of a fold.
 23When this fold is collapsed, only the above line will be visible.
 25{{{ A sub-section.
 26With text inside it.
 29{{{ Another sub-section.
 33   Both modes have distinct advantages and disadvantages; indent folding
 34   requires no changes to be made to a buffer's text and does a decent
 35   job with most program source. Explicit folding requires &#8220;<span class="quote">fold
 36   markers</span>&#8221; to be inserted into the text, but is more flexible in
 37   exactly what to fold away.
 38  </p><p>
 39   Some plugins might add additional folding modes; see
 40   <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.
 41  </p><p>
 42   Folding can be enabled in one of several ways:
 43  </p><div class="itemizedlist"><ul type="disc"><li><p>On a global or mode-specific
 44   basis in the <span><b class="guibutton">Editing</b></span> pane
 45   of the <span><b class="guimenu">Utilities</b></span>&gt;<span><b class="guimenuitem">Global
 46   Options</b></span> dialog box. See <a href="global-opts.html#editing-pane" title="The Editing Pane">the section called &#8220;The Editing Pane&#8221;</a>.</p></li><li><p>In the current buffer for the duration of the editing
 47   session in the
 48   <span><b class="guimenu">Utilities</b></span>&gt;<span><b class="guimenuitem">Buffer Options</b></span>
 49   dialog box. See <a href="buffer-opts.html" title="The Buffer Options Dialog Box">the section called &#8220;The Buffer Options Dialog Box&#8221;</a>.</p></li><li><p>In the current buffer for future editing sessions
 50   by placing the following in the first or last 10 lines of a buffer,
 51   where <i class="replaceable"><tt>mode</tt></i> is either &#8220;<span class="quote">indent</span>&#8221;,
 52   &#8220;<span class="quote">explicit</span>&#8221;, or the name of a plugin folding mode:
 53   </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>
 54    When using indent folding, portions of the buffer may become
 55    inaccessible if you change the leading indent of the first line of a
 56    collapsed fold. If you experience this, you can use the
 57    <span><b class="guimenuitem">Expand All Folds</b></span> command to make the text
 58    visible again.
 59   </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>
 60    The first line of each fold has a triangle
 61    drawn next to it in the gutter (see <a href="overview.html" title="Interface Overview">the section called &#8220;Interface Overview&#8221;</a> for
 62    more information about the gutter). The triangle points toward the
 63    line when the fold is collapsed, and downward when the fold is
 64    expanded.
 65    Clicking the triangle collapses and
 66    expands the fold. To expand all sub-folds as well, hold down the
 67    <tt class="keycap">Shift</tt> while clicking.
 68   </p><p>
 69    The first line of a collapsed fold is drawn
 70    with a background color that depends on the fold level, and the number of
 71    lines in the fold is shown to the right of the line's text.
 72   </p><p>
 73    Folds can also be collapsed and expanded using menu item commands and
 74    keyboard shortcuts.
 75   </p><p>
 76    <span><b class="guisubmenu">Folding</b></span>&gt;<span><b class="guimenuitem">Collapse
 77    Fold</b></span> (shortcut: <tt class="keycap">A+BACK_SPACE</tt>)
 78    collapses the fold
 79    containing the caret.
 80   </p><p>
 81    <span><b class="guisubmenu">Folding</b></span>&gt;<span><b class="guimenuitem">Expand
 82    Fold One Level</b></span> (shortcut: <tt class="keycap">A+ENTER</tt>)
 83    expands the
 84    fold containing the caret. Nested folds will remain collapsed,
 85    and the caret will be positioned on the first nested fold (if any).
 86   </p><p>
 87    <span><b class="guisubmenu">Folding</b></span>&gt;<span><b class="guimenuitem">Expand
 88    Fold Fully</b></span> (shortcut: <tt class="keycap">AS+ENTER</tt>)
 89    expands the fold
 90    containing the caret, also expanding any nested folds.
 91   </p><p>
 92    <span><b class="guisubmenu">Folding</b></span>&gt;<span><b class="guimenuitem">Collapse
 93    All Folds</b></span> (shortcut: <tt class="keycap">C+e c</tt>)
 94    collapses all folds in the buffer.
 95   </p><p>
 96    <span><b class="guisubmenu">Folding</b></span>&gt;<span><b class="guimenuitem">Expand
 97    All Folds</b></span> (shortcut: <tt class="keycap">C+e x</tt>)
 98    expands all folds in the buffer.
 99   </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>
100    <span><b class="guisubmenu">Folding</b></span>&gt;<span><b class="guimenuitem">Go to Parent
101    Fold</b></span> (shortcut: <tt class="keycap">C+e u</tt>) moves
102    the caret to the fold containing the one at the caret position.
103   </p><p>
104    <span><b class="guisubmenu">Folding</b></span>&gt;<span><b class="guimenuitem">Go to Previous
105    Fold</b></span> (shortcut: <tt class="keycap">A+UP</tt>) moves
106    the caret to the fold immediately before the caret position.
107   </p><p>
108    <span><b class="guisubmenu">Folding</b></span>&gt;<span><b class="guimenuitem">Go to Next
109    Fold</b></span> (shortcut: <tt class="keycap">A+DOWN</tt>) moves
110    the caret to the fold immediately after the caret position.
111   </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>
112    <span><b class="guisubmenu">Folding</b></span>&gt;<span><b class="guimenuitem">Add
113    Explicit Fold</b></span> (shortcut: <tt class="keycap">C+e a</tt>)
114    surrounds the
115    selection with &#8220;<span class="quote">{{{</span>&#8221; and &#8220;<span class="quote">}}}</span>&#8221;. If the
116    current buffer's edit mode defines comment strings (see
117    <a href="commenting.html" title="Commenting Out Code">the section called &#8220;Commenting Out Code&#8221;</a>) the explicit fold markers will
118    automatically be commented out as well.
119   </p><p>
120    <span><b class="guisubmenu">Folding</b></span>&gt;<span><b class="guimenuitem">Select
121    Fold</b></span>
122    (shortcut: <tt class="keycap">C+e s</tt>)
123    selects all lines within the fold containing the caret.
124    <tt class="keycap">Control</tt>-clicking a fold expansion triangle
125    in the gutter has the same effect.
126   </p><p>
127    <span><b class="guisubmenu">Folding</b></span>&gt;<span><b class="guimenuitem">Expand
128    Folds With Level</b></span> (shortcut:
129    <tt class="keycap">C+e ENTER <i class="replaceable"><tt>key</tt></i></tt>)
130    reads the next character entered at the keyboard, and
131    expands folds in the buffer
132    with a fold level less than that specified, while collapsing all others.
133   </p><p>
134    Sometimes it is desirable to have files open with folds initially
135    collapsed. This can be configured as follows:
136   </p><div class="itemizedlist"><ul type="disc"><li><p>On a global or mode-specific
137    basis in the <span><b class="guibutton">Editing</b></span> pane
138    of the <span><b class="guimenu">Utilities</b></span>&gt;<span><b class="guimenuitem">Global
139    Options</b></span> dialog box. See <a href="global-opts.html#editing-pane" title="The Editing Pane">the section called &#8220;The Editing Pane&#8221;</a>.</p></li><li><p>In the current buffer for future editing sessions
140    by placing the following in the first or last 10 lines of a buffer,
141    where <i class="replaceable"><tt>level</tt></i> is the desired fold level:
142    </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>
143    The narrowing feature temporarily &#8220;<span class="quote">narrows</span>&#8221; the display
144    of a buffer to a specified region. Text outside the region is not
145    shown, but is still present in the buffer. 
146   </p><p>
147    Holding down <tt class="keycap">Alt</tt> while clicking a fold expansion triangle in the gutter will hide all lines the buffer except
148    those contained in the clicked fold.
149   </p><p>
150    <span><b class="guisubmenu">Folding</b></span>&gt;<span><b class="guimenuitem">Narrow
151    Buffer to Fold</b></span> (shortcut: <tt class="keycap">C+e n n</tt>)
152    hides all lines the buffer except
153    those in the fold containing the caret.
155   </p><p>
156    <span><b class="guisubmenu">Folding</b></span>&gt;<span><b class="guimenuitem">Narrow
157    Buffer to Selection</b></span> (shortcut: <tt class="keycap">C+e n s</tt>)
158    hides all lines the buffer
159    except those in the selection.
160   </p><p>
161    <span><b class="guisubmenu">Folding</b></span>&gt;<span><b class="guimenuitem">Expand
162    All Folds</b></span> (shortcut: <tt class="keycap">C+e x</tt>)
163    shows lines that were hidden as a result of narrowing.
164   </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>