Tutorial: Indentation Features

Index of All Documentation » Wing Pro Tutorial »


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 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 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:

/images/doc/en/intro/indent-tools.png

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.

Converting Indentation Styles

In Wing Pro and Wing Personal, the Indentation tool can be used to analyze and convert the style of indentation found in source files.

See Indentation Tool for details.

Folding

Unless the feature is disabled with the Editor > Folding > 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 for details.

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 for details.