Take the 2-minute tour ×
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've got a directory called build, which I cd into quite a bit.

If there isn't any directory bu* in the current directory, zsh tab completion: cd buTAB suggests messagebus/, which isn't in .. If I accept that completion, I end up in /private/var/empty.

I'm unsure which zsh option suggests this completion, but I'd love to turn it off. Any idea which setting does it?

For what it's worth, this is on OS X. On ubuntu, I get the suggestions libuuid messagebus with identical zsh settings.

share|improve this question
    
Does this happen if you run zsh -f (no config file)? If you run ZDOTDIR=/ zsh (only the system config file)? Since there are a lot of completion settings, it would help to know where this behavior is coming from. –  Gilles Oct 2 '12 at 22:28
add comment

1 Answer

/private/var/empty is likely the messagebus user's home directory. zsh offers expansion of home directories when it receives an argument to the cd function that it thinks looks like a user name. In your case, bu is expanded to messagebus by the approximate matcher, because no more specific matcher will trigger in an empty directory (on your Linux system, both uuid and messagebus are returned as possible approximate matches for the string bu).

It's possible to tell zsh which users it should consider for expansion in these circumstances by putting something like this in your ~/.zshrc:

zstyle ':completion:*' users user1 user2 root

Simply list all users you want the shell to consider, source ~/.zshrc to pick up the changes, and you should no longer get messagebus etc as possible completions.

share|improve this answer
add comment

Your Answer

 
discard

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.