/www/tags/NOV_07_2009/htdocs/users-guide/indent.html
HTML | 71 lines | 71 code | 0 blank | 0 comment | 0 complexity | 5bf2b96f2b292fe2c5fb4fc6845780fb 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>Tabbing and Indentation</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="modes.html" title="Edit Modes"><link rel="next" href="commenting.html" title="Commenting Out Code"></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">Tabbing and Indentation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="modes.html">Prev</a> </td><th width="60%" align="center">Chapter 6. Editing Source Code</th><td width="20%" align="right"> <a accesskey="n" href="commenting.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="indent"></a>Tabbing and Indentation</h2></div></div></div><p>jEdit makes a distinction between the <em class="firstterm">tab
- width</em>, which is is used when displaying hard tab characters,
- and the <em class="firstterm">indent width</em>, which is used when a level
- of indent is to be added or removed, for example by mode-specific auto
- indent routines. Both can be changed in one of several ways:</p><div class="itemizedlist"><ul type="disc"><li><p>On a global or mode-specific basis in the
- <span class="guibutton"><strong>Editing</strong></span> pane of the the
- <span class="guimenu"><strong>Utilities</strong></span>><span class="guimenuitem"><strong>Global
- Options</strong></span> dialog box. See <a class="xref" 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 class="guimenu"><strong>Utilities</strong></span>><span class="guimenuitem"><strong>Buffer
- Options</strong></span> dialog box. See <a class="xref" 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 one of the first or last 10 lines of
- the buffer, where <em class="replaceable"><code>n</code></em> is the desired
- tab width, and <em class="replaceable"><code>m</code></em> is the desired
- indent width:</p><pre class="screen">:tabSize=<em class="replaceable"><code>n</code></em>:indentSize=<em class="replaceable"><code>m</code></em>:</pre></li></ul></div><p><span class="guimenu"><strong>Edit</strong></span>><span class="guisubmenu"><strong>Indent</strong></span>><span class="guisubmenu"><strong>Shift
- Indent Left</strong></span> (shortcut: <code class="keycap">S+TAB</code> or
- <code class="keycap">A+LEFT</code>) removes one level of indent from each selected
- line, or the current line if there is no selection.</p><p><span class="guimenu"><strong>Edit</strong></span>><span class="guisubmenu"><strong>Indent</strong></span>><span class="guisubmenu"><strong>Shift
- Indent Right</strong></span> (shortcut: <code class="keycap">A+RIGHT</code>) adds one
- level of indent to each selected line, or the current line if there is
- no selection. Pressing <code class="keycap">Tab</code> while a multi-line selection
- is active has the same effect.</p><p><span class="guimenu"><strong>Edit</strong></span>><span class="guisubmenu"><strong>Indent</strong></span>><span class="guimenuitem"><strong>Remove
- Trailing Whitespace</strong></span> (shortcut: <code class="keycap">C+e r</code>)
- removes all whitespace from the end of each selected line, or the
- current line if there is no selection.</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="soft-tabs"></a>Soft Tabs</h3></div></div></div><p>Files containing hard tab characters may look less than ideal
- if the default tab size is changed, so some people prefer using
- multiple space characters instead of hard tabs to indent
- code.</p><p>This feature is known as <em class="firstterm">soft tabs</em>.
- Soft tabs can be enabled or disabled in one of several ways:</p><div class="itemizedlist"><ul type="disc"><li><p>On a global or mode-specific basis in the
- <span class="guibutton"><strong>Editing</strong></span> pane of the
- <span class="guimenu"><strong>Utilities</strong></span>><span class="guimenuitem"><strong>Global
- Options</strong></span> dialog box. See <a class="xref" 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 class="guimenu"><strong>Utilities</strong></span>><span class="guimenuitem"><strong>Buffer
- Options</strong></span> dialog box. See <a class="xref" 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 one of the first or last 10 lines
- of the buffer, where <em class="replaceable"><code>flag</code></em> is
- either “<span class="quote">true</span>” or “<span class="quote">false</span>”:</p><pre class="screen">:noTabs=<em class="replaceable"><code>flag</code></em>:</pre></li></ul></div><p>Changing the soft tabs setting has no effect on existing tab
- characters; it only affects subsequently-inserted tabs.</p><p><span class="guimenu"><strong>Edit</strong></span>><span class="guisubmenu"><strong>Indent</strong></span>><span class="guimenuitem"><strong>Spaces
- to Tabs</strong></span> converts soft tabs to hard tabs in the current
- selection, or the entire buffer if nothing is selected.</p><p><span class="guimenu"><strong>Edit</strong></span>><span class="guisubmenu"><strong>Indent</strong></span>><span class="guimenuitem"><strong>Tabs
- to Spaces</strong></span> converts hard tabs to soft tabs in the
- current selection, or the entire buffer if nothing is
- selected.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="autoindent"></a>Automatic Indent</h3></div></div></div><p>The auto indent feature inserts the appropriate number of tabs
- or spaces at the beginning of a line by looking at program
- structure.</p><p>In the default configuration, pressing <code class="keycap">ENTER</code>
- will create a new line with the appropriate amount of indent
- automatically, and pressing <code class="keycap">TAB</code> at the beginning
- of, or inside the leading whitespace of a line will insert the
- appropriate amount of indentation. Pressing it again will insert a
- tab character.</p><p>The behavior of the <code class="keycap">ENTER</code> and
- <code class="keycap">TAB</code> keys can be configured in the
- <span class="guibutton"><strong>Shortcuts</strong></span> pane of the
- <span class="guimenu"><strong>Utilities</strong></span>><span class="guimenuitem"><strong>Global
- Options</strong></span> dialog. box, just as with any other key. The
- <code class="keycap">ENTER</code> key can be bound to one of the following, or
- indeed any other command or macro:</p><div class="itemizedlist"><ul type="disc"><li><p><span class="guimenuitem"><strong>Insert Newline</strong></span>.</p></li><li><p><span class="guimenuitem"><strong>Insert Newline and Indent</strong></span>,
- which is the default.</p></li></ul></div><p>The <code class="keycap">TAB</code> can be bound to one of the following,
- or again, any other command or macro:</p><div class="itemizedlist"><ul type="disc"><li><p><span class="guimenuitem"><strong>Insert Tab</strong></span>.</p></li><li><p><span class="guimenuitem"><strong>Insert Tab or Indent</strong></span>, which
- is the default.</p></li><li><p><span class="guimenuitem"><strong>Indent Selected
- Lines</strong></span>.</p></li></ul></div><p>See <a class="xref" href="global-opts.html#shortcuts-pane" title="The Shortcuts Pane">the section called “The Shortcuts Pane”</a> for details.</p><p>Auto indent behavior is mode-specific. In most edit modes, the
- indent of the previous line is simply copied over. However, in
- C-like languages (C, C++, Java, JavaScript), curly brackets and
- language statements are taken into account and indent is added and
- removed as necessary.</p><p><span class="guimenu"><strong>Edit</strong></span>><span class="guisubmenu"><strong>Indent</strong></span>><span class="guisubmenu"><strong>Indent
- Selected Lines</strong></span> (shortcut: <code class="keycap">C+i</code>) indents
- all selected lines, or the current line if there is no
- selection.</p><p>To insert a literal tab or newline without performing
- indentation, prefix the tab or newline with <code class="keycap">C+e v</code>.
- For example, to create a new line without any indentation, type
- <code class="keycap">C+e v ENTER</code>.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="modes.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="commenting.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Edit Modes </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Commenting Out Code</td></tr></table></div></body></html>