Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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.

share|improve this question
It might be due to cdpath, try unsetting it: cdpath=(). – Thor Aug 15 '12 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 '12 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. – Ulrich Dangel Aug 15 '12 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 '12 at 11:59

3 Answers 3

up vote 3 down vote accepted

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

See the Manual's chapter about Options for details.

share|improve this answer

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)

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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