58

I switched to zsh completely on a previous arch install and I LOVED it mainly because arch is one of the distros that capitalizes your Documents, Downloads, Music and such directories in your ~ directory. Since I wasn't used to that and I use tab completion for almost everything in the terminal zsh was like heaven for me compared to bash.... I swear this feature used to be active automatically because I don't remember having to tweak anything to make it work that way. I probably figured it out on accident. xD But I would greatly like to have this feature restored on my new pc using zsh as my main shell, and if anyone knows how to do this I would really appreciate a reply. I tried activating every option in the completion configuration and that didn't seem to do the trick... so that brought me here.

PS: I used to be a lot more up to date with my Linux know-how, and my knowledge has grown stale... I'm trying to remedy that... (without the use of the shift key, as much as possible... haha)

cmaher
  • 103
Aaron
  • 581

1 Answers1

109

TL;DR: This is possible if you put these lines in your zsh config file, usually ~/.zshrc:

autoload -Uz compinit && compinit
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'

A little bit more information:

This is possible when using the zsh completion system (started by autoload -Uz compinit && compinit) and is controlled by a zstyle:

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

This tells zsh that small letters will match small and capital letters. (i.e. capital letters match only capital letters.)

If you want that capital letters also match small letters use instead:

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

If you want case-insensitive matching only if there are no case-sensitive matches add '', e.g.

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

See also the description of matcher-list in man zshcompsys.

mpy
  • 28,816