> On 2012-01-16, Christian Brabandt wrote:
>> On Sun, January 15, 2012 2:53 pm, Marcin Szamotulski wrote:
>> > 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).
>>
>> There are some problems with this solution. First you don't need to
>> escape the '/' in the collation (which doesn't really harm in your
>> case, I just wanted to mention it).
>>
>> Second, I am not sure, whether you want to have a Space replaced by
>> \_s\+ (the equivalence of ' \+'). Also this probably replaces too much
>> (e.g. spaces in collations).
>>
>> It's probably a matter of taste, but I would hate not to be able to
>> search for 'foo bar' wihtout excluding 'foo bar'. I would simply
>> replace the space by \_s, which should also work.
>
> \_s without the \+ won't work if the target phrase is split across
> multiple lines and those lines are indented.
Of course. But if I know, that the search phrase can only be delimited
by either one single space or one line single break, I don't want the RE
to be too relaxed and take several whitespace chars into consideration.
But as I said, YMMV, obviously.
regards,
Christian
--
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
No comments:
Post a Comment