Smart indentation
Enter puts the next line where the language expects it, closers line up with their openers, and Backspace clears an indent in one press.
You spend less time fixing whitespace: each new line starts at the right depth for the language you are writing, and Backspace takes an indent away in one press.
- Enter keeps the indent of the current line, and adds a level after a block opener such as
{, a trailing:in Python or YAML,doorthenin shell, or an open tag. - Pairs split into a stanza. Enter between
{and}puts the caret on an indented line with the closer dropped below. - Closers line up. Typing
),],}or a closing keyword such asend,fiordonemoves the line back to its opener.
In each language
- Python follows PEP 8:
else,exceptandfinallyline up with theirifortry, Enter afterreturnorpasssteps out a level, and an open bracket gives a hanging indent. Tab gives a line the indent Enter would. - Shell scripts indent the way shfmt lays them out:
casebodies indent,fi,doneandesacline up, and a here-document’s closing word stays at the margin so bash still finds it. - Brace languages such as Java, JavaScript and TypeScript indent a
casebody, the one statement under a brace-lessif, the next argument of an open call, and a.call chain. Enter inside/** … */continues it with*.
Backspace and indent style
- Smart Backspace clears a line’s whole indent in one press, and on a blank auto-indented line jumps back to the end of the line above. In Python and YAML, where indentation is syntax, it removes one level at a time.
- Tabs or spaces are read from the file. A Python file that mixes them the way Python rejects says “mixed indent” in the status bar.
See the Editing guide.