Move to start and end of search lookup

You are looking for cgn. From :help gn:

Search forward for the last used search pattern, like
with `n`, and start Visual mode to select the match.
If the cursor is on the match, visually selects it.
If an operator is pending, operates on the match.
E.g., "dgn" deletes the text of the next match.
If Visual mode is active, extends the selection
until the end of the next match.

The beauty of this is you can do cgn and then repeat the command with . and, yes, it will do the same operation on the next search pattern match. This becomes extraordinarily useful when you start searching with complicated regular expressions.

Leave a Comment