On 16-Mar-2007 20:59, A.J.Mechelynck wrote:


As far as I can tell everything is set up to give case-sensitive globbing. Bash does case-sensitive globbing at the command line and in a simple script

#!/bin/bash
echo file*

Do you believe vim is shelling out to do globbing under cygwin, rather than doing globbing internally? I tried to verify that vim is calling /bin/sh by replacing /bin/sh.exe with a script /bin/sh which leaves a debugging trail. But it appears that /bin/sh is not being called for :e file* (it is called for :sh, however).

I had the impression it did; but I guess I was wrong.

Indeed, vim does its own globbing; it looks like the main function for this is ExpandOne() in ex_getln.c. It determines whether to do based on whether CASE_INSENSITIVE_FILENAME is #define'd. For Cygwin, this is done in os_unix.h:

#if defined(__CYGWIN__) || defined(__CYGWIN32__)
# define WIN32UNIX /* Compiling for Win32 using Unix files. */
# define BINARY_FILE_IO

# define CASE_INSENSITIVE_FILENAME
# define USE_FNAME_CASE /* Fix filename case differences. */
#endif

Like it or not, this is the proper thing to do on Cygwin, since any normal Windows file systems are case insensitive. Arguably, this should be a file system property, not an operating system property – after all, you can mount a case-insensitive Windows file system under Linux. But I doubt that there is a good way to determine this on a file system by file system basis...

It would perhaps be an improvement if this was an option, instead of a compile-time decision. But there's an awful lot of "#ifdef CASE_INSENSITIVE_FILENAME"'s in the code, so that's probably a rather non-trivial change...

– Michael

Reply via email to