Tuesday, November 11, 2014

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

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.

>
> But in any case, I am not going to discuss this further, I have
> mentioned a workaround
> (which uses an even simpler pattern) and apart from that have no further
> opinion on that
> (except that it seems logical to me, to have '/' mean that the pattern
> must match
> at a directory).

Your workaround is not correct. `: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.

Note: if you use `~/**/*.ex` in `:args` command it will behave *exactly as OP requested **even in Vim-3.0***. Thus if `**` was supported in autocmd patterns it was a bug. Unfortunately autocmd patterns are limited regular expressions that match on path and *not* globs which support `**`.

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

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