Indentation Settings
Version:

Indentation settings determine the size of the tab stops, and control whether the Tab key should insert tabs or spaces. In addition to the automatic detection, they can be customized globally, per-syntax type, or per-file.

Basic SettingsπŸ”—

"tab_size" integerπŸ”—

The number of spaces a tab is considered equal to.

"translate_tabs_to_spaces" booleanπŸ”—

If true, spaces will be inserted up to the next tab stop when Tab is pressed, rather than inserting a tab character.

"detect_indentation" booleanπŸ”—

If true, the default, tab_size and translate_tabs_to_spaces will be calculated automatically when loading a file.

"use_tab_stops" booleanπŸ”—

If translate_tabs_to_spaces is true, use_tab_stops will make Tab insert, and Backspace delete, up to the next tab stop.

See Settings for information about how to set global and syntax-specific settings.

Indentation DetectionπŸ”—

When a file is loaded, its contents are examined, and the tab_size and translate_tabs_to_spaces settings are set for that file. The status area will report when this happens. While this generally works well, you may want to disable it. You can do that with the detect_indentation setting.

Indentation detection can be run manually via the View β–Ά Indentation β–Ά Guess Settings From Buffer menu, which runs the detect_indentation command.

Converting Between Tabs and SpacesπŸ”—

The View β–Ά Indentation menu has commands to convert leading white space in the current file between tabs and spaces. These menu items run the expand_tabs and unexpand_tabs commands.

Automatic Indentation SettingsπŸ”—

Automatic indentation guesses the amount of leading white space to insert on each line when you press enter. It’s controlled with these settings:

"auto_indent" booleanπŸ”—

Enables auto indent.

Default: true

"smart_indent" booleanπŸ”—

Makes auto indent a little smarter, e.g., by indenting the next line after an if statement in C.

Default: true

"trim_automatic_white_space" booleanπŸ”—

Trims white space added by auto_indent when moving the caret off the line.

Default: true

"indent_to_bracket" booleanπŸ”—

Adds white space up to the first open bracket when indenting. Use when indenting like this:

use_indent_to_bracket(to_indent,
                      like_this);

Default: false