glob() reflects the behaviour of the underlying filesystem. In Windows, "dir FoO*.*" will list both FOOBAR.TXT and foobar.htm if present. In Linux, "ls -l FoO*" will list neither, even if present. That's why glob() is case-insensitive in Windows and case-sensitive in Linux.

I suppose one could create a custom GlobIC() function that would call vanilla glob() on Dos/Win32 platforms, and massage the search string on *nix...something like this 100% untested

function! GlobIC(searchstring)
if has('unix')
        let l:s = substitute(a:searchstring, '\a', '[\l\1\u\1]', 'g')
else
        let l:s = a:searchstring
endif
return glob(l:s)
endfunc


(that replacement is "backslash ell, backslash one, backslash ewe, backslash one")


It would only allow through the "*" and "?" metachars (which both platforms support), as it would likely hose any character-classes on the *nix side of things (e.g. "file_[a-z]*.txt" would get mistakenly translated to "file_[[aA]-[zZ]]*.txt")

However, it might be a step towards a solution for you.

-tim



Reply via email to