Step 4 of 8

Splitting a selection

Splitting a selection

s keeps the matches. Its capital sibling S does the opposite: it keeps everything between the matches. Think of it as splitting the selection wherever the pattern occurs.

That’s exactly what you want when a line is a list. Select the line, press S, type the separator, and you get one cursor per item, with the separators left out of the selections. From there c rewrites every item, ~ changes its case, and d deletes it.

The prompt works the same way as s: the pieces light up as you type, and Enter keeps them.

Work through the checklist below to split a list of fruit into four selections.

  1. Select the line with x The whole line highlights when you press x.
  2. Split it on the commas with S Press S and type a comma and a space — each fruit lights up on its own.
  3. Switch the case of every fruit with ~ Hit Enter to close the prompt — all four words turn to capitals when you press ~.
Select the line with x The whole line highlights when you press x.

Next: Split it on the commas with S

Loading editor…