I recently switched to zsh from bash, and I'm using oh-my-zsh. There's a completion behaviour I don't want: in any directory, the list of autocompletion candidates seems to include the names of all users' home directories.

I wasn't able to find the right zsh option to disable this behaviour out of the hundreds that exist.

  • It might be due to cdpath, try unsetting it: cdpath=().
    – Thor
    Aug 15, 2012 at 2:47
  • Doesn't look like the case. I'm using oh-my-zsh, and this behaviour disappears when I don't source it. But I'm still wondering which setting is responsible, so I can just turn that one off.
    – jogloran
    Aug 15, 2012 at 2:51
  • can you give an example what command and which parameter you try to complete? If you are e.g. in /home and have enabled autocd this is expected as it is completing a directory. Aug 15, 2012 at 10:23
  • @UlrichDangel: Here's the exact behaviour (modulo exact directory names). I'm in my own home directory (say /home/jogloran). I want to access a directory /home/jogloran/apple/banana, so I type cd apple/ba<TAB>. But in addition to the path apple/banana, there's a user called bambi, and there are two completion candidates: bambi and banana. Worse, bambi comes first in the completion list. If I select bambi, I get taken to ~bambi. I'm not in /home, so this isn't expected behaviour, and I've tried cdpath=() beforehand.
    – jogloran
    Aug 15, 2012 at 11:59

3 Answers 3


The option responsible for this behaviour is `cdable_vars'. It's not enabled by default.

See the Manual's chapter about Options for details.


According to manual, zsh tries to expand the expression as if it were preceded by a ‘~’.

To unset the CDABLE_VARS option type in shell or add to .zshrc:

$ unsetopt cdablevars

(Before unsetting the option I had tens of seconds delay on hosts with autofs mounted home folder)


This behaviour is the combined effect of zsh's cdable_vars and auto_cd settings. oh-my-zsh sets these settings in ~/.oh-my-zsh/lib/theme-and-appearance.zsh if you want to get rid of them.

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.