Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Why doesn't cd ignore files when you type say "cd fred*"

zzapper wrote:

> Yes tasty! ( I've called this cdd and left the builtin cd alone). (is
> the keyword function optional?)
> But are there any solutions using COMPCTRL?


With old style completion, try the globcomplete option.

With new completion, you can use the _match completer. You can use it
in the main list of completers. That will cause all globs like "fred*"
to be matched against the completion matches.

I prefer _expand because it does proper filename generation, handling
globbing flags etc but I bind _match to a separate key. So if I was to
do `cd fred*' and then press escape *, it would just complete the
directory. I think this below is the relevant setup code I use. You may
want to adjust the first zstyle and do without the second.

bindkey '\e*' match-word
zstyle ':completion:match-word::::' completer _all_matches _match _ignored
zstyle ':completion:match-word:*' match-original both
zle -C match-word complete-word _generic


Messages sorted by: Reverse Date, Date, Thread, Author