Inspect and reuse a search

0 of 3

The technique

Your textVim mode: Normal
Find the next two ready lines. Before: first ready / second ready / third ready. After: first ready / second ready / third ready.

* searches for the word under the cursor. n repeats the search in the same direction.

Keys in this lesson

n
Next match.
N
Previous match.
*
Search for the word under the cursor.
#
The same, backward.

Before this lesson: Search for a destination.

More about this lesson

Repeat or reverse a search and distinguish whole-word matching.

n repeats the direction of your last search; N reverses it. After ?, n still searches backward. * searches forward for the whole word under the cursor; # searches backward. /cat may match catalog; * from cat skips catalog. Inspect each destination before editing an exception.

Example

With three separate “ready” lines, /ready then Enter reaches the first next occurrence and n the following one. N returns to the previous match. Search movement does not itself modify any text.

Use Reset to try again.

Guides on this topic

Exercise 1 of 3

0keys

par 8

Search forward for the status, then continue past the longer word to the second exact status. Finish on line 3, column 17, without changing the text.

Your textVim mode: Normal

Desired result

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
Reset the exercise
Ctrl+Alt+P
Previous exercise
Ctrl+Alt+N
Next exercise
Enter
After a solve: the next step

Ctrl+Alt shortcuts leave Vim's own keys alone. On a Mac, Control and Option.