Preben Randhol wrote:
Hi
I'm trying to make a small function which should search for a pattern
in the current buffer. I want that all matches are highlighted by
hlsearch and that I can jump to the next by pressing 'n'
Is this possible? When I try to use execute or normal it searches, but
neither hlsearch work or 'n' works.
Thanks in advance
Preben
:let @/ = pattern
will set the search pattern and (if 'hlsearch' is on) highlight it
wherever it matches, but not move the cursor. n will then jump to the
next match after the cursor (or N to the next match before the cursor).
see
:help quote/
:help @/
HTH,
Tony.