PageRenderTime 64ms CodeModel.GetById 48ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1<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
 2        width</em>, which is is used when displaying hard tab characters,
 3        and the <em class="firstterm">indent width</em>, which is used when a level
 4        of indent is to be added or removed, for example by mode-specific auto
 5        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
 6                <span class="guibutton"><strong>Editing</strong></span> pane of the the
 7                <span class="guimenu"><strong>Utilities</strong></span>&gt;<span class="guimenuitem"><strong>Global
 8                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
 9                session in the
10                <span class="guimenu"><strong>Utilities</strong></span>&gt;<span class="guimenuitem"><strong>Buffer
11                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
12                placing the following in one of the first or last 10 lines of
13                the buffer, where <em class="replaceable"><code>n</code></em> is the desired
14                tab width, and <em class="replaceable"><code>m</code></em> is the desired
15                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>&gt;<span class="guisubmenu"><strong>Indent</strong></span>&gt;<span class="guisubmenu"><strong>Shift
16        Indent Left</strong></span> (shortcut: <code class="keycap">S+TAB</code> or
17        <code class="keycap">A+LEFT</code>) removes one level of indent from each selected
18        line, or the current line if there is no selection.</p><p><span class="guimenu"><strong>Edit</strong></span>&gt;<span class="guisubmenu"><strong>Indent</strong></span>&gt;<span class="guisubmenu"><strong>Shift
19        Indent Right</strong></span> (shortcut: <code class="keycap">A+RIGHT</code>) adds one
20        level of indent to each selected line, or the current line if there is
21        no selection. Pressing <code class="keycap">Tab</code> while a multi-line selection
22        is active has the same effect.</p><p><span class="guimenu"><strong>Edit</strong></span>&gt;<span class="guisubmenu"><strong>Indent</strong></span>&gt;<span class="guimenuitem"><strong>Remove
23        Trailing Whitespace</strong></span> (shortcut: <code class="keycap">C+e r</code>)
24        removes all whitespace from the end of each selected line, or the
25        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
26            if the default tab size is changed, so some people prefer using
27            multiple space characters instead of hard tabs to indent
28            code.</p><p>This feature is known as <em class="firstterm">soft tabs</em>.
29            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
30                    <span class="guibutton"><strong>Editing</strong></span> pane of the
31                    <span class="guimenu"><strong>Utilities</strong></span>&gt;<span class="guimenuitem"><strong>Global
32                    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
33                    session in the
34                    <span class="guimenu"><strong>Utilities</strong></span>&gt;<span class="guimenuitem"><strong>Buffer
35                    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
36                    placing the following in one of the first or last 10 lines
37                    of the buffer, where <em class="replaceable"><code>flag</code></em> is
38                    either &#8220;<span class="quote">true</span>&#8221; or &#8220;<span class="quote">false</span>&#8221;:</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
39            characters; it only affects subsequently-inserted tabs.</p><p><span class="guimenu"><strong>Edit</strong></span>&gt;<span class="guisubmenu"><strong>Indent</strong></span>&gt;<span class="guimenuitem"><strong>Spaces
40            to Tabs</strong></span> converts soft tabs to hard tabs in the current
41            selection, or the entire buffer if nothing is selected.</p><p><span class="guimenu"><strong>Edit</strong></span>&gt;<span class="guisubmenu"><strong>Indent</strong></span>&gt;<span class="guimenuitem"><strong>Tabs
42            to Spaces</strong></span> converts hard tabs to soft tabs in the
43            current selection, or the entire buffer if nothing is
44            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
45            or spaces at the beginning of a line by looking at program
46            structure.</p><p>In the default configuration, pressing <code class="keycap">ENTER</code>
47            will create a new line with the appropriate amount of indent
48            automatically, and pressing <code class="keycap">TAB</code> at the beginning
49            of, or inside the leading whitespace of a line will insert the
50            appropriate amount of indentation. Pressing it again will insert a
51            tab character.</p><p>The behavior of the <code class="keycap">ENTER</code> and
52            <code class="keycap">TAB</code> keys can be configured in the
53            <span class="guibutton"><strong>Shortcuts</strong></span> pane of the
54            <span class="guimenu"><strong>Utilities</strong></span>&gt;<span class="guimenuitem"><strong>Global
55            Options</strong></span> dialog. box, just as with any other key. The
56            <code class="keycap">ENTER</code> key can be bound to one of the following, or
57            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>,
58                    which is the default.</p></li></ul></div><p>The <code class="keycap">TAB</code> can be bound to one of the following,
59            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
60                    is the default.</p></li><li><p><span class="guimenuitem"><strong>Indent Selected
61                    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 &#8220;The Shortcuts Pane&#8221;</a> for details.</p><p>Auto indent behavior is mode-specific. In most edit modes, the
62            indent of the previous line is simply copied over. However, in
63            C-like languages (C, C++, Java, JavaScript), curly brackets and
64            language statements are taken into account and indent is added and
65            removed as necessary.</p><p><span class="guimenu"><strong>Edit</strong></span>&gt;<span class="guisubmenu"><strong>Indent</strong></span>&gt;<span class="guisubmenu"><strong>Indent
66            Selected Lines</strong></span> (shortcut: <code class="keycap">C+i</code>) indents
67            all selected lines, or the current line if there is no
68            selection.</p><p>To insert a literal tab or newline without performing
69            indentation, prefix the tab or newline with <code class="keycap">C+e v</code>.
70            For example, to create a new line without any indentation, type
71            <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>