Sunday, February 11, 2018

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

On 11/02/2018 20:18, Nikolay Aleksandrovich Pavlov wrote:
> 2018-02-11 21:44 GMT+03:00 Lifepillar <lifepillar@lifepillar.me>:
>> 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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment