Skip to content

Indentation plugin

Choose how indentation works and adjust the indentation of selected lines.

Where to find it

Edit ▸ Indent:

  • Increase Indent — Ctrl+]
  • Decrease Indent — Ctrl+[

Both act on every line touched by the selection, or the caret's line when nothing is selected.

Settings

Open Preferences ▸ Plugins ▸ Indentation:

  • Indent style — Tabs, Spaces, or Auto (detect from document).
    • Tabs (the default for new files) inserts a real tab per level.
    • Spaces inserts Spaces per indent spaces per level.
    • Auto looks at the document's existing indentation and follows it — a tab-indented file keeps using tabs, a 2-space file keeps using two spaces, and so on. A file with no indentation yet falls back to the default (tabs).
  • Spaces per indent — how many spaces make up one indent level (also the visual width of a tab).
  • Wrapped lines — where the continuation rows of a word-wrapped long line start (wrapping itself is toggled with View ▸ Word Wrap):
    • Align with the line's indentation (the default) — continuation rows line up under the first row's indentation, so an indented block wraps as one visual column.
    • Start at the left edge — continuation rows restart at the window edge, the word-processor look.
    • Indent one level deeper — like the default plus one extra indent level, which makes the wrap point easier to spot.
  • Pasting: Re-indent pasted lines to the caret's indentation (on) — a multi-line block pasted at an indented caret is re-indented to that caret instead of arriving ragged. The behaviour itself is part of the editor's paste command; only the switch lives here, next to the other indentation options. The switch applies to Paste as Markdown too. See Pasting a block of code.

The chosen style is the single source of truth for the whole editor: the Tab key, Backspace unindent, and automatic indentation all use it.

Automatic indentation

Pressing Enter carries the current line's leading whitespace onto the new line, so you stay at the same depth without re-typing tabs or spaces. When the caret sits between a freshly opened bracket pair, the block opens out:

if (cond) {|}        Enter        if (cond) {
                     ───────►          |
                                   }

The new line is indented one level deeper and the closing brace drops to its own line at the opener's depth. Automatic indentation stands down inside comments and string literals, where a { is ordinary text rather than a block opener.

A project's .editorconfig and a language's shipped indent default (Python → 4 spaces, Go → tabs, …) both take precedence over the global style chosen here — see per-language defaults for the table and the full resolution order.

For the full editing behaviour — auto-pairing brackets/quotes, type-over, deleting an empty pair, block-open on Enter, comment/string suppression and multi-caret support — see Auto-pair & indentation.