PageRenderTime 45ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/www/tags/NOV_07_2009/htdocs/users-guide/folding.html

#
HTML | 98 lines | 95 code | 3 blank | 0 comment | 0 complexity | 7ba25727d17fad354449012f5f21584d 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
  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
  13. Another 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.
  15. When this fold is collapsed, only the above line will be visible.
  16. {{{ A sub-section.
  17. With text inside it.
  18. }}}
  19. {{{ Another sub-section.
  20. }}}
  21. }}}</pre><p>Both modes have distinct advantages and disadvantages; indent
  22. folding requires no changes to be made to a buffer's text and does a
  23. decent job with most program source. Explicit folding requires
  24. &#8220;<span class="quote">fold markers</span>&#8221; to be inserted into the text, but is more
  25. 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
  26. <span class="guibutton"><strong>Editing</strong></span> pane of the
  27. <span class="guimenu"><strong>Utilities</strong></span>&gt;<span class="guimenuitem"><strong>Global
  28. 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
  29. session in the
  30. <span class="guimenu"><strong>Utilities</strong></span>&gt;<span class="guimenuitem"><strong>Buffer
  31. 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
  32. placing the following in the first or last 10 lines of a buffer,
  33. where <em class="replaceable"><code>mode</code></em> is either
  34. &#8220;<span class="quote">indent</span>&#8221;, &#8220;<span class="quote">explicit</span>&#8221;, or the name of a
  35. 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
  36. inaccessible if you change the leading indent of the first line of a
  37. collapsed fold. If you experience this, you can use the
  38. <span class="guimenuitem"><strong>Expand All Folds</strong></span> command to make the text
  39. 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
  40. the gutter (see <a class="xref" href="overview.html" title="Interface Overview">the section called &#8220;Interface Overview&#8221;</a> for more information
  41. about the gutter). The triangle points toward the line when the fold
  42. is collapsed, and downward when the fold is expanded. Clicking the
  43. triangle collapses and expands the fold. To expand all sub-folds as
  44. 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
  45. color that depends on the fold level, and the number of lines in the
  46. fold is shown to the right of the line's text.</p><p>Folds can also be collapsed and expanded using menu item
  47. commands and keyboard shortcuts.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Collapse
  48. Fold</strong></span> (shortcut: <code class="keycap">A+BACK_SPACE</code>)
  49. collapses the fold containing the caret.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Expand Fold
  50. One Level</strong></span> (shortcut: <code class="keycap">A+ENTER</code>) expands
  51. the fold containing the caret. Nested folds will remain collapsed,
  52. and the caret will be positioned on the first nested fold (if
  53. any).</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Expand Fold
  54. Fully</strong></span> (shortcut: <code class="keycap">AS+ENTER</code>) expands
  55. the fold containing the caret, also expanding any nested
  56. folds.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Collapse All
  57. Folds</strong></span> (shortcut: <code class="keycap">C+e c</code>) collapses all
  58. folds in the buffer.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Expand All
  59. Folds</strong></span> (shortcut: <code class="keycap">C+e x</code>) expands all
  60. 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
  61. Fold</strong></span> (shortcut: <code class="keycap">C+e u</code>) moves the
  62. 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
  63. Previous Fold</strong></span> (shortcut: <code class="keycap">A+UP</code>) moves
  64. 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
  65. Fold</strong></span> (shortcut: <code class="keycap">A+DOWN</code>) moves the
  66. 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
  67. Fold</strong></span> (shortcut: <code class="keycap">C+e a</code>) surrounds the
  68. selection with &#8220;<span class="quote">{{{</span>&#8221; and &#8220;<span class="quote">}}}</span>&#8221;. If the
  69. 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
  70. automatically be commented out as well.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Select
  71. Fold</strong></span> (shortcut: <code class="keycap">C+e s</code>) selects all
  72. lines within the fold containing the caret.
  73. <code class="keycap">Control</code>-clicking a fold expansion triangle in the
  74. gutter has the same effect.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Expand Folds
  75. With Level</strong></span> (shortcut: <code class="keycap">C+e ENTER
  76. <em class="replaceable"><code>key</code></em></code>) reads the next character
  77. entered at the keyboard, and expands folds in the buffer with a fold
  78. level less than that specified, while collapsing all others.</p><p>Sometimes it is desirable to have files open with folds
  79. 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
  80. <span class="guibutton"><strong>Editing</strong></span> pane of the
  81. <span class="guimenu"><strong>Utilities</strong></span>&gt;<span class="guimenuitem"><strong>Global
  82. 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
  83. placing the following in the first or last 10 lines of a
  84. buffer, where <em class="replaceable"><code>level</code></em> is the
  85. 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
  86. display of a buffer to a specified region. Text outside the region
  87. is not shown, but is still present in the buffer. </p><p>Holding down <code class="keycap">Alt</code> while clicking a fold
  88. expansion triangle in the gutter will hide all lines the buffer
  89. except those contained in the clicked fold.</p><p><span class="guisubmenu"><strong>Folding</strong></span>&gt;<span class="guimenuitem"><strong>Narrow Buffer
  90. to Fold</strong></span> (shortcut: <code class="keycap">C+e n n</code>) hides all
  91. 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
  92. to Selection</strong></span> (shortcut: <code class="keycap">C+e n s</code>)
  93. 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
  94. Folds</strong></span> (shortcut: <code class="keycap">C+e x</code>) shows lines
  95. 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>