Make search part of an edit

0 of 4

The technique

Your textVim mode: Normal
Delete everything before keep. Before: Remove this; keep the note. After: keep the note.

The match itself stays. c/keep would delete the same text and let you type in its place.

Keys in this lesson

d/text
Delete up to a search match. Press Enter after the text.
c/text
Change up to a search match.

Before this lesson: Search foundations and operator grammar.

More about this lesson

Delete or change text up to a word you can see, and leave lookalike words alone.

d/pattern then Enter deletes up to the next match and keeps the match itself, even when the match is on another line. c/ deletes the same text and puts you in Insert mode. When the end is a character on the same line, dt is shorter, and a WORD or two goes with d2W.

Example

From Remove in “Remove this; keep the note”, d/keep then Enter leaves “keep the note”. c/keep stops at the same place and lets you type new text.

Use Start over to try again.

Guides on this topic

Exercise 1 of 4

0keys

par 6

Shorten the note: remove which you can read at any time on the help page, .

Your textVim mode: Normal

Make it look like this

import { translate } from "../i18n/translate";

// Shown under the Pay button.
export const PAY_NOTE = translate(
  "By paying you accept our terms, and our privacy policy.",
);

Yours

Par

Keyboard shortcuts
Ctrl+Enter
Check the result
Ctrl+Alt+U
Undo the last change
Ctrl+Alt+H
Show the next hint
Ctrl+Alt+R
Start the exercise over
Ctrl+Alt+P
Previous exercise
Ctrl+Alt+N
Next exercise
Ctrl+Alt+K⌃⌥K
Show the keyboard shortcuts
Ctrl+Alt+F⌃⌥F
Turn focus mode on or off
Ctrl+Alt+S⌃⌥S
Open the editor settings
Enter
Go on to the next step after you finish

The Ctrl+Alt shortcuts don't clash with Vim's own keys. On a Mac, use Control and Option.