Tutorial: Indentation Features

Index of All Documentation » Wing Tutorial »

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


By now you will have noticed that Wing auto-indents lines as you type, according to context. This can be disabled with the 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.

Block Indentation

In Wing's default keyboard personality, the Tab key is defined to indent the current line or blocks of lines, rather then entering a tab character (which can be done with Ctrl-Tab). As noted earlier, the Tab Key Action preference can be used to customize how the tab key behaves.

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


Repeated presses of the Match Indent tool will move the selected lines among the possible correct indent levels for that context.

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


Unless the feature is disabled with the 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 context menu.

Folding acts in such a way that selecting across a fold and copying will copy the text, including its hidden portions. Take a look at the Folding sub-menu in the Source menu and refer to Folding for details.