I'm trying out zsh and there's a tab-completion behavior that I'm finding annoying: It seems that if I type cd str and hit TAB, it will auto complete with *str*. For example, cd pl TAB results in an autocompletion of cd Applications/ because 'Applications' contains 'pl'.

Is there a way to turn this off?

I know zsh has a tab completion feature where cd /u/loc/b TAB will get you to /usr/local/bin. Is this behavior related?

  • Operating System: OSX 10.11
  • Zsh version: 5.0.8
  • oh-my-zsh plugins: git, zsh-syntax-highlighting, z


I've tracked the offending block of code down to my ~/.oh-my-zsh/oh-my-zsh.sh file.

67 if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
68   # If completion insecurities exist, warn the user without enabling completions.
69   if ! compaudit &>/dev/null; then
70     # This function resides in the "lib/compfix.zsh" script sourced above.
71     handle_completion_insecurities
72   # Else, enable and cache completions to the desired file.
73   else
74     compinit -d "${ZSH_COMPDUMP}"
75   fi
76 else
77     compinit -i -d "${ZSH_COMPDUMP}"
78 fi

I'm still reading documentation and trying to figure out exactly what's going on.

1 Answer 1


Ok. I think I've got it sorted out. This post was very helpful.

Basically, oh-my-zsh sets the completion to

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

Removing 'l:|=* r:|=*' (which is the last rule) now gives me the desired behavior.

The ability to do cd /u/lo/b/ TAB is not compromised.

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.