Just tried your new version lookupfile plugin, it can now works in case-insensitive mode!
Thanks everybody! Eddy 2006/9/3, Hari Krishna Dara <[EMAIL PROTECTED]>:
On Sat, 2 Sep 2006 at 10:25pm, Hari Krishna Dara wrote: > > 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 I got the below working, without using the sub-replace-special for second function: function! FilePatIgnoreCase(filePat) return substitute(a:filePat, '\(\[.\{-}]\)\|\(\a\)', \ '\=submatch(0)=~"^["?TranslateAlpha(submatch(0), 1):TranslateAlpha(submatch(0), 0)', 'g') endfunction function! TranslateAlpha(pat, inCollection) if a:inCollection return substitute(substitute(a:pat, '-\@<[EMAIL PROTECTED]', '&\u&', 'g'), \ '\(\a\)-\(\a\)', '\1-\2\u\1-\u\2', 'g') else return substitute(a:pat, '\a', '[\l&\u&]', 'g') endif endfunction -- Thanks, Hari __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com