On 07:48 Sun 15 Jan     , Tim Chase wrote:
> On 01/15/12 05:41, Pau wrote:
> > I very frequently have to look for a couple of words in a huge
> > document to find the place where I have to resume work or do
> > modifications. Unfortunately, the search function stops in a new line,
> > so that if I look for "a very interesting place which was far away"
> > vim will not find it if there is a new line, i.e. something like this
> >
> > a very
> > interesting place
> > which was far away
> >
> > How can I tell vim to ignore new lines in the search function?
> 
> I don't think there's anything as easy as a flag, but you can use 
> \_s to mean "a whitespace that includes a newline".  If you only 
> havev one, you ca, search for
> 
>   a\_svery\_sinteresting\_splace\_swhich\_swas\_sfar\_saway
> 
> If you have more than one such whitespace, you can make each 
> instance "\_s\+" to consume them.  Using the command-line window 
> makes this a LOT easier to generate.
> 
>    :help /\_s
>    :help q:
> 
> -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

This is so useful that I made cmap for it
cmap <expr> <space> ( getcmdtype() =~ '[\/?]' && getcmdline() !~ '\\v' ? 
'\_s\+' : ( getcmdline() =~ '\\v' ? '\_s+' : ' ' ) )

which also works if you use \v (very magic patterns).

Best,
Marcin

-- 
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