Step 4 of 6

Yanking, pasting, and replacing

Yanking, pasting, and replacing

Three more actions that work on a selection:

  • y yanks (copies) the selection
  • p pastes the last yank after the selection
  • r followed by a character replaces every character in the selection with that one character

Yank and paste let you move text around without going through insert mode: select a word and press y, move the cursor, press p. Helix selects the text it just pasted, so you can act on it again straight away.

r is handy for turning a run of characters into something else — select a row of dashes and type r= to make a double rule, for example.

Work through the checklist below.

  1. Yank the word yank The cursor starts on it — press e to select it, then y to copy.
  2. Paste it on the next line with p Move down onto the empty line with j, then press p — the pasted word lands there by itself and stays selected.
  3. Replace every r on the last line with z Jump to the last line with ge, then gh for its start. Select rrrrr with e, then type rz.
Yank the word yank The cursor starts on it — press e to select it, then y to copy.

Next: Paste it on the next line with p

Loading editor…