Tuesday, November 11, 2014

Re: ** matches one or more directories, not zero or more

Am 2014-11-12 01:31, schrieb ZyX:
> On Wednesday, November 12, 2014 3:29:10 AM UTC+3, ZyX wrote:
>> On Tuesday, November 11, 2014 2:11:34 PM UTC+3, Christian Brabandt
>> wrote:
>> > Am 2014-11-11 11:30, schrieb John Little:
>> > > On Tuesday, November 11, 2014 9:08:59 PM UTC+13, Christian Brabandt
>> > > wrote:
>> > >> Since the behaviour of ** is not standardized and vim is no shell,
>> > >> that
>> > >> is no argument for or against anything.
>> > >
>> > > I beg to differ on that. Vim is obviously copying functionality that
>> > > came from shells.
>> >
>> > I think the Vim implementation of '**' predates the bash implementation
>> > (which appears to
>> > be available only since bash 4).
>>
>> There is also (t)csh, zsh, Python, etc. I do not think it is worth
>> digging out who was copying what, but Vim has `**` functionality since
>> at least 3.0.

Last time I used tcsh, it did not have ** and this was way after Vim 3
release. But that is
exactly my point. The behaviour of ** is not standardized and is no
argument for what so ever.
(zsh probably had it earlier, I do not remember)

>> Your workaround is not correct.

Indeed, it should have been ~/*.ex. It is not a workaround. It is what
the OP wanted.

>> `:h autocmd-pattern` implicitly says that `**` for recursive matches
>> is not supported and explicitly says that `*` "matches any sequence of
>> characters: Unusual: includes path". So one should use `~/*.ex` and do
>> not use `~/**.ex` in order to not trick oneself in believing `**` is
>> supported.

Correct.

> By "is supported" I meant "has any special meaning". In your variant
> writing `**` is as good as writing `.*.*` in regex: it will work, but
> it is pointless (and will cause minor performance degradation in many
> regex engines).

No it is not. Both patterns are converted to the regexp
^/home/user/.*\.ex$

Best,
Chrisitan

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment