Combining zsh’s tab completion with case insensitivity

I have zsh 5.0.7 configured to use case-insensitive tab completion with

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

The problem I’m having is that this case insensitivity often leads to my needing to press Tab an extra time. For example, my home directory contains the folders “Desktop”, “Documents”, and “Downloads”. If I’m in my home folder and I type

cd D

and then press Tab, I see the three possibilities listed for me. On the other hand, if I type

cd d

and then press Tab then the “d” changes to “D” but I don’t see the completion menu; I need to press Tab again for that to happen. Is there a way to get the completion menu at the same time that the “d” is changed to a “D”?

Asked By: bdesham

||

Enabling the option MENU_COMPLETE will skip the correction and immediately insert the first possible match.

Answered By: llua

Another useful setting could be

setopt no_list_ambiguous

It will correct “c” to “C” and show the completion menu.

Answered By: Shaoyun

The OP and the answers didn’t work for me. The top answer here works fine:


put these lines in your zsh config file, usually ~/.zshrc:

autoload -Uz compinit && compinit
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
Answered By: Marcin
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.