Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

RE: Case insensitive completion problems with cygwin



After a fair bit of trial-and-error I've found the following settings seem to achieve the desired result:

  zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
  zstyle ':completion:*:paths' accept-exact 'c:' 'b:' 'w:' 'r:' 'v:'
  zstyle ':completion:*' fake-files '/:c' '/:b' '/:w' '/:r' '/:v'

That is, I now get case-insensitive completion for all the following:
$ ls /c/p<TAB>
$ ls /C/p<TAB>
$ ls c:/p<TAB>
$ ls C:/p<TAB>

Assuming this is a recommended approach, perhaps a candidate for the FAQ?

(Btw, I've used cygwin's `mount -c' to change the cygdrive prefix to '/' rather than the default '/cygdrive', so that my drives appears as '/c', '/v', etc rather than the more usual '/cygdrive/c', '/cygdrive/v', etc.)

    --- John. 
________________________________________
From: John Cooper [mailto:john.cooper@xxxxxxxxxxxxx] 
Sent: 01 November 2006 18:13
To: zsh-users@xxxxxxxxxx
Subject: Case insensitive completion problems with cygwin

[I'm using zsh 4.3.2 on Windows 2003 with cygwin]
If I run `zsh -f' file completion works as expected in all the following:
$ ls /c/<TAB>
$ ls /C/<TAB>
$ ls c:/<TAB>
$ ls C:/<TAB>
However, after running the following:
  zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
  autoload -U compinit
  compinit -C
$ ls /c/<TAB>   # fails - no completions are listed
$ ls /C/<TAB>   # works as expected
$ ls c:/<TAB>   # fails - no completions are listed
$ ls C:/<TAB>   # works as expected

I've found I can work around the problem by adding a '' to the above matcher-list, namely:
  zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}'
However, this isn't really the behavior I'd like as the following will no longer
automatically complete both uppercase and lowercase matches. So if I now type
the following:
$ ls /c/p<TAB>
.. it will no longer list "/c/Program\ Files" as one of the completion matches,
and I have to manually hit backspace and change to an uppercase "P".
So, if I revert to the original matcher-list and try messing with fake-files:
  zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
  zstyle ':completion:*' fake-files '/:c g h l r w z'
.. I then get the desired behavior where the following lists all files
beginning with 'p' or 'P':
$ ls /c/p<TAB>
However, now the following no longer works:
$ ls c:/<TAB>  # fails - no completions are listed

Is there a way to get true case-insensitive completion working for both /c/ and
c:/ as a prefix?
Thanks,
    --- John



Messages sorted by: Reverse Date, Date, Thread, Author