I have the following line in my zshrc to make filename completions case-insensitive:

zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'

This works most of the time but I’ve noticed that if I type “git add ” and then press Tab then the completions I get are case-sensitive.

Is there a different command I should be using to make filename completions case-insensitive? Or do I need to start adding zstyle declarations for individual commands? (And if that’s the answer, what should those declarations look like?)


You need to also add

setopt nocaseglob

to your ~/.zshrc.

The files for any git completion are generated by calling git ls-files with a glob pattern, which is case-sensitive by default. Unsetting caseglob will cause them to be insensitive to case instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.