Sunday, December 27, 2009

Re: start search at current line, wrap around?

On Dec 26, 12:33 pm, Bee <200...@calcentral.com> wrote:
> :.,$s/search/replace/gc
>
> Will start searching at the current line,
> but continue only to the end of file.
>
> How to wrap the search back around to the current line?
>
> I know the following starts at the beginning of the file and seaches
> thru to the end of file.
>
> :%s/search/replace/gc

Ex commands (like :s) work on ranges, starting from the first line in
the range and going to the last line, with the first line required to
be no lower in the file than the last. In short, you cannot start at
one line and finish above it using a single Ex command.

You could, however, run your .,$ search, then use command-line history
(by pressing the <Up> key on the command-line) to recall your command
and edit the range as desired to get the first line to the current
line.

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: