<type>documentation</type>
<domain>intro</domain>
<id>tutorial-indentation</id>
<title>Tutorial: Indentation Features</title>
<date>$Date: 2011-02-23 15:44:41 -0500 (Wed, 23 Feb 2011) $</date>
<product>all</product>

Since indentation is syntactically significant in Python, Wing provides a number of
features to make working with indentation easier.

**Auto-Indentation**

By now you will have noticed that Wing auto-indents lines as you type, according to
context. This can be disabled with the `Editor > Indentation > Auto-Indent
<script:show_preferences_gui#prefname="edit.auto-indent">`__ preference.

Wing also adjusts the indentation of blocks of code that are pasted into the editor. If
the indentation change is not what you wanted, a single ``Undo`` removes the indentation
adjustment, if there was one.

See `Auto-indent <ref:edit/auto-indent>`__ for details.

**Block Indentation**

One or more selected lines can be increased or reduced in indentation, or adjusted to
match indentation according to context, from the ``Indentation`` toolbar group:

.. image:: indent-tools.png
  :width: 128
  :height: 41
  
Repeated presses of the ``Match Indent`` tool will move the selected lines among the
possible syntactically correct indent levels for that context. The default action of the
``Tab`` key does the same thing.

These indentation features are also available in the ``Source`` menu, where their key
bindings are listed.

~~~if not WING101:
**Converting Indentation Styles**

In Wing Pro and Wing Personal, the `Indentation <script:show_panel#panel_type="indent">`__
tool can be used to analyze and convert the style of indentation found in source files.

See `Indentation Tool <ref:edit/indentation-manager>`__ for details.

**Folding**

Unless the feature is disabled with the `Editor > Folding > Enable Folding
<script:show_preferences_gui#prefname="edit.enable-folding">`__ preference, Wing Pro and
Wing Personal can fold editor code by indentation levels to hide areas that are not
currently of interest, or as a way to see a quick summary of the contents of a source
file.

The folding operations are enumerated in the ``Folding`` sub-menu of the ``Source`` menu
and in the fold margin's right-click context menu.

Folding acts in such a way that selecting across a fold and copying will copy the text,
including its hidden portions.

See `Folding <ref:edit/folding>`__ for details.
~~~

~~~if not WING101:
**Other Features**

Wing Pro and Wing Personal can also show indentation guides on the editor and set
preferred indentation style and policies, among other things. See `Indent Guides,
Policies, and Warnings <ref:edit/indent-guides>`__ for details.
~~~
