On Fri, 1 Sep 2006 at 11:19pm, Eddy Zhao wrote:

> Sorry, forget to mention, I'm using vim on linux.
>
> 2006/9/1, Eddy Zhao <[EMAIL PROTECTED]>:
> > Hi,
> >
> >     I'm using vim 7.0, and find glob is case-sensitive. Is there way
> > to make glob case-insensitive ? I'm asking this because some plugin
> > (like lookupfile) rely on glob, and case-sensitive globbing is very
> > inconvenient. (BTW, I'm  finding on windows glob is case-insensitive)
> >
> > Thanks
> > Eddy
> >

I came up with the below following Tim's suggestion (sorry, don't have
his email, so replying to yours), but this has a problem as it seems
like using sub-replace-special recursively doesn't work. Is this not
supported or a bug?

" Translates the file pattern to ignore case on non-case-insensitive systems.
function! FilePatIgnoreCase(filePat)
  return substitute(a:filePat, '\(\[.\{-}\]\)\|\(\a\)',
        \
'\=submatch(0)=~"^["?"[".TranslateAlpha(strpart(submatch(0),1,len(submatch(0))-1),
1)."]":TranslateAlpha(submatch(0), 0)', 'g')
endfunction

function! TranslateAlpha(pat, insideCollection)
  if a:insideCollection
    return substitute(a:pat, '\(\a-\a\)\|\a',
          \
'\=submatch(0)=~"-"?submatch(0).toupper(submatch(0)):submatch(0).toupper(submatch(0))',
'g')
  else
    return substitute(a:pat, '\a', '[\l&\u&]', 'g')
  endif
endfunction

I need to rework this to avoid one or both of the sub-replace-specials.

--
Thanks,
Hari

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to