With the following in an empty directory:
$ zsh -d -f -i
% autoload -Uz compinit && compinit
% zstyle ':completion:*:*:cd:*:*' ignored-patterns foo
% mkdir foo
% mkdir bar
% mkdir zsh
- When I type
cd <TAB>I get a menu with onlybarandzsh. This is great. - When I remove
zshand I docd <TAB>,baris completed without showing a menu. Also great. - But when I remove
baras well and I docd <TAB>,foois completed. I don't want that to happen. - Starting again, but from the parent directory and doing
cd <TAB>to complete the parent directory and thencd <TAB>I seefooor get it completed for all three cases.
Is there a way to ignore foo completely so I never see it and never get it completed in the same directory and any other directory?
Edit:
I found that using zstyle ':completion:*:*:cd:*:*' ignored-patterns '**/foo' the problem of seeing the ignored pattern from a parent directory goes away, but ignored patterns are still completed when there is not other choice. So with this:
$ zsh -d -f -i
% autoload -Uz compinit && compinit
% zstyle ':completion:*:*:cd:*:*' ignored-patterns '**/foo'
% mkdir foo
and typing cd <Tab> still completes foo. Is there a way of just not completing in this case?