When I type

cd l

and hit tab, zsh autocompletes to

cd lightdm/ 

this is not a directory that is available to me (in fact I've uninstalled lightdm).

How do I stop this from happening?

I have prezto installed.



This is probably the combination of the AUTO_NAME_DIRS and CDABLE_VARS options documented in zshoptions(1).

% PS1='%# ' zsh -f
% setopt CDABLE_VARS
% autoload -U compinit
% compinit
% cd a        # was mashing tab here to no avail (nor asdf)
cd: no such file or directory: a
% hash -d asdf=/etc
% cd asdf/    # "cd a" now tab completes

(This was discovered by searching zshoptions for "dir" and "cd" related strings.)

To turn this off disable one or more of those options (unsetopt) or remove the variable(s) that the completion code is finding.


As user thrig has already mentioned in his answer, this was caused by CDABLE_VARS option being set.

I had a similar issue and fixed it by adding

unsetopt CDABLE_VARS

line to my .zshrc

  • I see --- as clear as thrig's answer was, I was not able to follow it until I saw yours. – Bart Snapp Apr 1 '19 at 13:50

I ended up looking into .zhistory and deleting all references to lightdm this solved the problem for me. There maybe be other places zsh stores completions, but I don't know what they are.

  • This is totally bogus -- and didn't work. – Bart Snapp Apr 1 '19 at 13:50

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.