2

I have zsh setup to do case insensitive completion but somehow file matching for git completion remains case sensitive:

% zsh -f
% autoload -U compinit && compinit
% zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
% setopt nocasematch
% touch Foo
% ls fo[TAB]
% ls Foo # completes to foo
Foo
% git add fo[TAB] # does not complete

Any ideas?

Francisco
  • 3,980
  • 1
  • 23
  • 27

2 Answers2

2

Try this:

% zstyle ':completion:*:*:git:files' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'

I don't know why this is necessary, probably something in the implementation of the _git completion code. That thing is over 6000 lines long.

msteed-ac
  • 21
  • 2
  • Did this fix it for you? Does not work here. Neither with `zsh -f` nor with my complicated zshrc getting used. – Francisco Jun 25 '14 at 09:39
  • 1
    Sorry, I was testing with git diff instead of git add. It turns out that the above has no real effect. I tried digging into the completion code but got lost pretty quickly. – msteed-ac Jun 25 '14 at 15:45
2

Solution: take _git from Zsh's 'master' branch. Latest version of Zsh today is 5.0.5, zsh's master I took _git from is at commit c8e5be9d0fbbc6fb1cf06175b7c3d4757f6d973c.

Repository is at git://git.code.sf.net/p/zsh/code.

With these unreleased changes completion for git-add is case insensitive.

At Zsh-5.0.5 stuff like git-diff is case insensitive but git-add is not.

Francisco
  • 3,980
  • 1
  • 23
  • 27