47348Re: Change highlighted pattern, don't move cursor/window
- Feb 1, 2004On 2004-02-01, Fred Ma <fma@...> wrote:
> Hi,How about this?
> When I use vim to search for a pattern with the "/",
> the cursor moves to the next occurance, and all matching
> text is highlighted. That's almost exactly what I want.
> I want to provide a pattern to highlight from the command
> line, but I don't want the cursor to move, or the window
> to scroll. I thought I could find where vim stores it's
> notion of last pattern searched for, but can't seem to
> find it. It isn't in hlsearch or search(). Is this
:match Search /pattern/
Vim keeps the search pattern in the "/ register, so you could also
:let @/ = "pattern"
but that won't highlight the pattern unless search highlighting is
already turned on. To turn in on, you can
Gary Johnson | Agilent Technologies
garyjohn@... | Wireless Division
| Spokane, Washington, USA
- << Previous post in topic Next post in topic >>