PageRenderTime 102ms CodeModel.GetById 89ms app.highlight 6ms RepoModel.GetById 4ms app.codeStats 0ms


HTML | 98 lines | 95 code | 3 blank | 0 comment | 0 complexity | 7ba25727d17fad354449012f5f21584d 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.73.2"><link rel="start" href="index.html" title="jEdit 4.3 User's Guide"><link rel="up" href="source-edit.html" title="Chapter 6. Editing Source Code"><link rel="prev" 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><p>Program source code and other structured text files can be thought
 2        of as containing a hierarchy of sections, which themselves might contain
 3        sub-sections. The folding feature lets you selectively hide and show
 4        these sections, replacing hidden ones with a single line that serves as
 5        an &#8220;<span class="quote">overview</span>&#8221; of that section. Folding is disabled by
 6        default. To enable it, you must choose one of the available folding
 7        modes.</p><p>&#8220;<span class="quote">Indent</span>&#8221; mode creates folds based on a line's leading
 8        whitespace; the more leading whitespace a block of text has, the further
 9        down it is in the hierarchy. For example:</p><pre class="screen">This is a section
10  This is a sub-section
11  This is another sub-section
12    This is a sub-sub-section
13Another top-level section</pre><p>&#8220;<span class="quote">Explicit</span>&#8221; mode folds away blocks of text surrounded
14        with &#8220;<span class="quote">{{{</span>&#8221; and &#8220;<span class="quote">}}}</span>&#8221;. For example:</p><pre class="screen">{{{ The first line of a fold.
15When this fold is collapsed, only the above line will be visible.
17{{{ A sub-section.
18With text inside it.
21{{{ Another sub-section.
24}}}</pre><p>Both modes have distinct advantages and disadvantages; indent
25        folding requires no changes to be made to a buffer's text and does a
26        decent job with most program source. Explicit folding requires
27        &#8220;<span class="quote">fold markers</span>&#8221; to be inserted into the text, but is more
28        flexible in exactly what to fold away.</p><p>Some plugins might add additional folding modes; see <a class="xref" 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
29                <span class="guibutton"><strong>Editing</strong></span> pane of the
30                <span class="guimenu"><strong>Utilities</strong></span>&gt;<span class="guimenuitem"><strong>Global
31                Options</strong></span> dialog box. See <a class="xref" 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
32                session in the
33                <span class="guimenu"><strong>Utilities</strong></span>&gt;<span class="guimenuitem"><strong>Buffer
34                Options</strong></span> dialog box. See <a class="xref" 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 by
35                placing the following in the first or last 10 lines of a buffer,
36                where <em class="replaceable"><code>mode</code></em> is either
37                &#8220;<span class="quote">indent</span>&#8221;, &#8220;<span class="quote">explicit</span>&#8221;, or the name of a
38                plugin folding mode:</p><pre class="screen">:folding=<em class="replaceable"><code>mode</code></em>:</pre></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
39            inaccessible if you change the leading indent of the first line of a
40            collapsed fold. If you experience this, you can use the
41            <span class="guimenuitem"><strong>Expand All Folds</strong></span> command to make the text
42            visible again.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2564915"></a>Collapsing and Expanding Folds</h3></div></div></div><p>The first line of each fold has a triangle drawn next to it in
43            the gutter (see <a class="xref" href="overview.html" title="Interface Overview">the section called &#8220;Interface Overview&#8221;</a> for more information
44            about the gutter). The triangle points toward the line when the fold
45            is collapsed, and downward when the fold is expanded. Clicking the
46            triangle collapses and expands the fold. To expand all sub-folds as
47            well, hold down the <code class="keycap">Shift</code> while clicking.</p><p>The first line of a collapsed fold is drawn with a background
48            color that depends on the fold level, and the number of lines in the
49            fold is shown to the right of the line's text.</p><p>Folds can also be collapsed and expanded using menu item
50            commands and keyboard shortcuts.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Collapse
51            Fold</strong></span> (shortcut: <code class="keycap">A+BACK_SPACE</code>)
52            collapses the fold containing the caret.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Expand Fold
53            One Level</strong></span> (shortcut: <code class="keycap">A+ENTER</code>) expands
54            the fold containing the caret. Nested folds will remain collapsed,
55            and the caret will be positioned on the first nested fold (if
56            any).</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Expand Fold
57            Fully</strong></span> (shortcut: <code class="keycap">AS+ENTER</code>) expands
58            the fold containing the caret, also expanding any nested
59            folds.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Collapse All
60            Folds</strong></span> (shortcut: <code class="keycap">C+e c</code>) collapses all
61            folds in the buffer.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Expand All
62            Folds</strong></span> (shortcut: <code class="keycap">C+e x</code>) expands all
63            folds in the buffer.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2565065"></a>Navigating Around With Folds</h3></div></div></div><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Go to Parent
64            Fold</strong></span> (shortcut: <code class="keycap">C+e u</code>) moves the
65            caret to the fold containing the one at the caret position.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Go to
66            Previous Fold</strong></span> (shortcut: <code class="keycap">A+UP</code>) moves
67            the caret to the fold immediately before the caret position.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Go to Next
68            Fold</strong></span> (shortcut: <code class="keycap">A+DOWN</code>) moves the
69            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="id2565138"></a>Miscellaneous Folding Commands</h3></div></div></div><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Add Explicit
70            Fold</strong></span> (shortcut: <code class="keycap">C+e a</code>) surrounds the
71            selection with &#8220;<span class="quote">{{{</span>&#8221; and &#8220;<span class="quote">}}}</span>&#8221;. If the
72            current buffer's edit mode defines comment strings (see <a class="xref" href="commenting.html" title="Commenting Out Code">the section called &#8220;Commenting Out Code&#8221;</a>) the explicit fold markers will
73            automatically be commented out as well.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Select
74            Fold</strong></span> (shortcut: <code class="keycap">C+e s</code>) selects all
75            lines within the fold containing the caret.
76            <code class="keycap">Control</code>-clicking a fold expansion triangle in the
77            gutter has the same effect.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Expand Folds
78            With Level</strong></span> (shortcut: <code class="keycap">C+e ENTER
79            <em class="replaceable"><code>key</code></em></code>) reads the next character
80            entered at the keyboard, and expands folds in the buffer with a fold
81            level less than that specified, while collapsing all others.</p><p>Sometimes it is desirable to have files open with folds
82            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
83                    <span class="guibutton"><strong>Editing</strong></span> pane of the
84                    <span class="guimenu"><strong>Utilities</strong></span>&gt;<span class="guimenuitem"><strong>Global
85                    Options</strong></span> dialog box. See <a class="xref" 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 by
86                    placing the following in the first or last 10 lines of a
87                    buffer, where <em class="replaceable"><code>level</code></em> is the
88                    desired fold level:</p><pre class="screen">:collapseFolds=<em class="replaceable"><code>level</code></em>:</pre></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><p>The narrowing feature temporarily &#8220;<span class="quote">narrows</span>&#8221; the
89            display of a buffer to a specified region. Text outside the region
90            is not shown, but is still present in the buffer. </p><p>Holding down <code class="keycap">Alt</code> while clicking a fold
91            expansion triangle in the gutter will hide all lines the buffer
92            except those contained in the clicked fold.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Narrow Buffer
93            to Fold</strong></span> (shortcut: <code class="keycap">C+e n n</code>) hides all
94            lines the buffer except those in the fold containing the caret. </p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Narrow Buffer
95            to Selection</strong></span> (shortcut: <code class="keycap">C+e n s</code>)
96            hides all lines the buffer except those in the selection.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Expand All
97            Folds</strong></span> (shortcut: <code class="keycap">C+e x</code>) shows lines
98            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>