Friday, February 19, 2010

Re: Reduce search to unfolded parts

On Fri, Feb 19, 2010 at 12:46 PM, Christian Brabandt <cblists@256bit.org> wrote:
> Hi Jean!
>
> On Fr, 19 Feb 2010, Jean Johner wrote:
>
>> After having folded some parts of a file, the search command (/) looks
>> in the complete file, unfolding parts where the pattern is found.
>>
>> Is it possible to reduce the search to visible parts.
>
> :h 'foldopen' I am not sure, if this works with a substitute command.
>
> May be something like this works:
> :%s/foobar/\=printf("%s", foldlevel(".")?submatch(0):'foo')/

Better,

:folddoopen s/foobar/foo/g

~Matt

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

No comments: