PageRenderTime 129ms CodeModel.GetById 23ms RepoModel.GetById 5ms app.codeStats 0ms

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