Search for visually selected text

Search for visually selected text Edit


Search for visually selected text

Tip 171 Printable Monobook Previous Next

created2001 · complexitybasic · authorRaymond Li · version6.0

With this tip, you can select some text, then press a key to search for the next occurrence of the text. Two alternative methods are presented.

Features

  • Press * to search forwards for selected text, or # to search backwards.
  • As normal, press n for next search, or N for previous.
  • Handles multiline selection and search.
  • Whitespace in the selection matches any whitespace when searching (searching for "hello world" will also find "hello" at the end of a line, with "world" at the start of the next line).
  • Each search is placed in the search history allowing you to easily repeat previous searches.
  • No registers are changed.

Place the following mappings in your vimrc:

发表回复