Thursday, March 12, 2015

Re: conversion file pattern <-> regex pattern

Am 2015-03-12 11:48, schrieb Enno:
> Le vendredi 6 mars 2015 17:47:15 UTC+1, Enno a écrit :
>> To check if a file path 'path' matches &backupskip,
>> the naive try
>>
>> path ~=# &backupskip
>>
>> does not work because &backupskip is a file pattern
>> as used for autocmd events. Is there a function
>> 'file2regex()' that converts &backupskip to a Vim regex
>> pattern so that
>>
>> path ~=# file2regex(&backupskip)
>>
>> is true if and only if path matches &backupskip?
>
> Cool, thanks Christian!
>
> There is for example the function netrw_gitignore#Hide(...)
> that comes with Vim and achieves a similar conversion, but
> an infallible implementation requires diligence.
>
> Cleaner and stabler would be making Vim's function public.
> Hope Bram merges your patch.

Perhaps, we should ping Bram (CC'ed). Not sure if this is really useful.

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: