This behaviour can be caused by the shell option nullglob, which may be, for example, turned on in your .bashrc. The reason is that the _longopt function has a bug in its definition, which causes this behaviour with _longopt turned on. The solution is to disable this option or to override the _longopt function yourself. A similar effect is also described ...


_files -W $HOME/.local/lib -/ -S "" -F "*/*" does the job: -S "" to suppress the addition of a suffix /, and _F "*/*" excludes subdirectories (via _path_files and compadd)). -F causes the ignored-patterns style to be ignored, which is a minor downside of this approach. There may be a better way.

Only top voted, non community-wiki answers of a minimum length are eligible