Step 3 of 7

Yanking a selection

Yanking a selection

A line is just one kind of selection. Anything you can select, you can yank: a word made with e, a selection grown in select mode with v, or anything else from the previous lessons. p then pastes it right after the cursor.

There’s a sibling key, P, which pastes before the selection instead of after it. And if you want to swap a selection out for what you yanked, R replaces the selection with the yanked text in one go.

Work through the checklist below.

  1. Start a selection in select mode Put the cursor where you want the selection to start, then press v.
  2. Yank the selection Extend the selection with any motions you like — a word, a sentence, whatever takes your fancy. Press y and Helix drops you back into normal mode.
  3. Paste it at the bottom of the file Move to the --> line (ge gets you there), jump to the end of the line with gl, then press p.
Start a selection in select mode Put the cursor where you want the selection to start, then press v.

Next: Yank the selection

Loading editor…