Glob filename containing { (left brace) in Windows

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Glob filename containing { (left brace) in Windows

Lifepillar
Is there any way for glob() to expand a filename containing
{ (left brace) in Windows *without* removing { from isfname?

For example, if the current dir has a file called '{foo', then

   :echo glob('\{*')

correctly expands to '{foo' provided that isfname does not
contain {; otherwise, the above gives E220: missing }.

There is an example in `:h wildcard`, but it uses square brackets
and I am not sure how it could be adapted.

Thanks,
Life.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Glob filename containing { (left brace) in Windows

Nikolay Aleksandrovich Pavlov
2018-02-11 21:44 GMT+03:00 Lifepillar <[hidden email]>:

> Is there any way for glob() to expand a filename containing
> { (left brace) in Windows *without* removing { from isfname?
>
> For example, if the current dir has a file called '{foo', then
>
>   :echo glob('\{*')
>
> correctly expands to '{foo' provided that isfname does not
> contain {; otherwise, the above gives E220: missing }.
>
> There is an example in `:h wildcard`, but it uses square brackets
> and I am not sure how it could be adapted.

It looks like your issue has the same source as $-related parts of
https://github.com/vim/vim/issues/541 (no resolution there though).

>
> Thanks,
> Life.
>
> --
> --
> 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 [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Glob filename containing { (left brace) in Windows

Lifepillar
On 11/02/2018 20:18, Nikolay Aleksandrovich Pavlov wrote:

> 2018-02-11 21:44 GMT+03:00 Lifepillar <[hidden email]>:
>> Is there any way for glob() to expand a filename containing
>> { (left brace) in Windows *without* removing { from isfname?
>>
>> For example, if the current dir has a file called '{foo', then
>>
>>    :echo glob('\{*')
>>
>> correctly expands to '{foo' provided that isfname does not
>> contain {; otherwise, the above gives E220: missing }.
>>
>> There is an example in `:h wildcard`, but it uses square brackets
>> and I am not sure how it could be adapted.
>
> It looks like your issue has the same source as $-related parts of
> https://github.com/vim/vim/issues/541 (no resolution there though).

Thanks, path globbing in Windows look quite… complicated. For now,
the best I could do is replacing '{' and '}' with '[\{]' and '[\}]',
respectively. So, the example above becomes:

     :echo glob('[\{]*')

When braces are in isfname, this returns nothing ('[\{]' does not
match a left brace), but at least it does not raise errors. If braces
are removed from isfname, the above returns '{foo'.

Life.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.