'**2' item works in findfile() but not in globpath()

3 views
Skip to first unread message

Erik Falor

unread,
Jan 8, 2008, 6:40:17 PM1/8/08
to vim...@googlegroups.com
I like using the '**' wildcard in commands which search for files.  I REALLY like adding a digit to the end of it to limit how far it digs.  I wish it could
work with the globpath() function.

From editing.txt , line 1471:

"The file searching is currently used for the 'path', 'cdpath' and 'tags'
options, for |finddir()| and |findfile()|."

Is there any reason in particular why the +path_extra feature bestows special powers upon these options and functions, but not upon globpath()?


--
Registered Linux User #445632
http://counter.li.org

Bram Moolenaar

unread,
Jan 9, 2008, 5:31:27 AM1/9/08
to Erik Falor, vim...@googlegroups.com

Erik Falor wrote:

> I like using the '**' wildcard
> in commands which search for files. I REALLY like adding a digit to
> the end of it to limit how far it digs. I wish it could
> work with the globpath() function.
>

> >From editing.txt, line 1471:


>
> "The file searching is currently used for the 'path', 'cdpath' and 'tags'
> options, for |finddir()| and |findfile()|."
>
> Is there any reason in particular
> why the +path_extra feature bestows special powers upon these options
> and functions, but not upon globpath()?

There are two separate pieces of code that expand "**". One is what is
used for 'path' and a few other file-searching operations. This is
implemented in find_file_in_path(). The other is part of the file name
expansion, done with mch_expandpath().

They are not compatible, unfortunately. find_file_in_path() expands
wildcards in the path, but not in the file name. It does handle
"**2"and upwards search. mch_expandpath() expands all wildcards, but
does not support "**2" or upwards search.

Merging the two kinds of wildcard expansion is a lot of work.

--
There are three kinds of people: Those who can count & those who can't.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Reply all
Reply to author
Forward
0 new messages