Wednesday, December 23, 2009

Re: search across lines?

On 2009-12-22, Bee wrote:

> 2) I tried Gary's second version which substitutes all white space
> runs '\_s\+', it works on MacOS terminal with vim 7.2.315 but
> fails to substitute line endings with vi 6.2 and search fails.
> Any idea why?
> If I manually do a search for '\_s\+' line endings are found.

I don't know. I'd guess that the mapping uses some feature that was
added to vim after 6.2, but I couldn't tell you what.

> 3) Below, the search part is separated out for emphasis.
>
> In Gary's example escape() lists all items that are 'magic'.
> /<C-R><C-R>=substitute(escape(@", '\\/.*$^~[]'), '\n', '\\n', 'g')
>
> In the second, I use '\V' ('very nomagic')
> to make all but '\' not magic and then escape just '\'
> /\V<c-r>=substitute(escape(@", '\'), '\n', '\\n', 'g')
>
> Both work and all registers look the same.
> Is there some functional difference I am missing?

Other than the <C-R>= vs. <C-R><C-R>= thing, and without comparing
the two in detail, not that I know of.

Regards,
Gary


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

No comments: