Indentation Settings
Ver:
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_sizeandtranslate_tabs_to_spaceswill be calculated automatically when loading a file.
- "use_tab_stops" booleanπ
If
translate_tabs_to_spacesistrue,use_tab_stopswill 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 menu, which runs the detect_indentation
command.
Converting Between Tabs and Spacesπ
The 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_indentwhen 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