Step 1 of 6

Selection makes everything else easy

Selection makes everything else easy

Helix editing follows one pattern: first make a selection, then act on it. Vim does it the other way around — you name the verb first and the object second, as in dw for “delete a word”. In Helix you select the word first and then press d. The order is object, then verb.

The advantage is that you can always see what you’re about to edit. The selection is highlighted before anything happens to it, so there are no surprises.

There are several ways to make a selection in normal mode:

  • word motions like w, b, and e select from the cursor to wherever they land
  • x selects the current line (press it again to extend to the next line)
  • % selects the whole file

Line motions like j and k only move the cursor — they leave a one-character selection behind. Extending a selection as you move up and down needs select mode, which we’ll cover in a later lesson.

Once you have a selection, you act on it with a single key: d to delete, c to change, y to yank. Work through the checklist below to make a few selections. Nothing is changed yet — that comes in the next step.

  1. Select a word with w From normal mode, press w — the word after the cursor lights up.
  2. Select the whole line with x Press x — the selection grows to cover the current line.
  3. Select the whole file with % Press % — everything in the buffer is selected at once.
Select a word with w From normal mode, press w — the word after the cursor lights up.

Next: Select the whole line with x

Loading editor…