Selecting inside a selection
Copying a cursor line by line is fine for neighbouring lines. The command you
will actually reach for most is s: select regex. It takes the current
selection, looks for every match of a pattern inside it, and gives each match
its own cursor.
The recipe is always the same:
- make a selection that covers the text you care about —
%for the whole buffer,xfor a few lines, or any motion - press
sand type a pattern; the matches light up as you type - hit
Enterto keep them
From there, you’re back in normal mode with one cursor per match, and any
command acts on all of them. Changing every match with c is the classic
example, but d, y, i, a and the rest all work the same way.
Nothing matching? Escape in the prompt abandons the search and leaves your
original selection alone.
Work through the checklist below to turn every TODO into DONE in one edit.