Step 2 of 5

Indenting

Indenting

Two keys move lines sideways:

  • > indents the selected lines by one level
  • < unindents them by one level

A level is whatever the file already uses — Helix looks at the existing indentation when it opens a file, and falls back to the language’s default when there’s nothing to go on. This buffer is indented with four spaces, so that’s what each press adds or removes.

Both keys act on whole lines, so the selection doesn’t have to cover a line exactly: a bare cursor is enough for one line, and any selection that touches several lines indents all of them. Both also take a count, so 3> indents three levels at once.

Work through the checklist below to fix the two lines that are out of place, then shift the whole buffer and shift it back.

  1. Indent add sugar with > Move down to the add sugar line and press >.
  2. Unindent add milk with < Move up to the add milk line and press <.
  3. Indent the whole buffer Press % to select everything, then > — every line moves right by one level.
  4. Put it back with < The selection is still there — press <.
Indent add sugar with > Move down to the add sugar line and press >.

Next: Unindent add milk with <

Loading editor…