On 11/22/11 07:16, Graham Lawrence wrote:
Then they are quite different, I was thinking /@" in script would be
the equivalent of /^R" at the command line.

You can do the following in a script which, while 2 steps, I find equally clear as Tony's use of search()

  let @/=@"
  /

The first line assigns the contents of the scratch register to the search register and the second line searches for it (somewhat the equiv. of hitting "n" in normal mode) since there's no regexp after it. Either method works, and one or the other may have subtle advantages over the other (clarity of search-direction, verbosity, etc)

As a side-note, depending on your line's contents, you may have to wrap the value of @" in a call to escape(), as in

  let @/=escape(@/, '.\[*~')
  call search(escape(@/, '.\[*~'))

(untested, though the only gotcha would be my accidental omission of some characters to be escaped)

-tim



--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to