Using automatic indenting
Prev
Next

Using automatic indenting

Kates editor component supports a variation of autoindenting modes, designed for different text formats. You can pick from the available modes using the Tools->Indentation menu. The autoindent modules also provides a function Tools->Align which will recalculate the indentation of the selected or current line. Thus, you may reindent your entire document by selecting all the text and activating that action.

All the indent modes use the indentation related settings in the active document.

Tip

You can set all sorts of configuration variables, including those related to indentation using Document Variables and File types.

Available Autoindent Modes

None

Selecting this mode turns automatic indenting off entirely.

Normal

This indenter simply keeps the indentation similar to the previous line with any content other than whitespace. You can combine this with using the indent and unindent actions for indenting to your own taste.

C Style

An indenter for C and similar languages, such as C++, C#, java, javascript and so on. This indenter will not work with scripting languages such as Perl or PHP.

SS C Style

An alternative indenter for C and similar languages, with the same constraints.

Python Style

An indenter specifically for the python scripting language.

XML

A very nice XML auto-indenter. However tempting, do not try to use this with HTML other than XHTML, because it fails with the old style HTML tags (open tags like for example <br>)

Variable Indenter

Note

The variable indenter is experimental, and may change behavior or disappear in future versions.

The variable indenter is special in that it can be configured using variables in the document (or in a filetype configuration). The followwing variables are read:

var-indent-indent-after

A regular expression which will cause a line to be indented by one unit, if the first non-whitespace-only line above matches. var-indent-indent: A regular expression, which will cause a matching line to be indented by one unit.

var-indent-unindent

A regular expression which will cause the line to be unindented by one unit if matching.

var-indent-triggerchars

A list of characters that should cause the indention to be recalculated immediately when typed.

var-indent-handle-couples

A list of parenthese sets to handle. Any combination of 'parens' 'braces' and 'brackets'. Each set type is handled the following way: If there are unmatched opening instances on the above line, one indent unit is added, if there are unmatched closing instances on the current line, one indent unit is removed.

var-indent-couple-attribute

When looking for unmatched couple openings/closings, only characters with this attribute are considered. The value must be the attribute name from the syntax xml file, for example "Symbol". If it's not specified, attribute 0 is used (usually 'Normal Text').

Prev
Next
Home


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team