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

completing and hiding some prefixes



I have files in ~/foo/. Among them, some are named: fa_abc fa_frog
fa_gag. I want to write completion for a command "fofa", which completes
among these particular files, but omitting the "fa_" prefix. Thus:

  $ fofa [TAB]
  $ fofa abc[TAB]
  $ fofa frog

I tried a few options of compadd, like -p, but it seems I would need to
write a separate function.

It would perhaps be interesting to have something more general, which
can complete for commands on the same pattern, but different
suffix/prefixes.

This is my naive attempt:

#compdef fofa

local cachedir

cachedir=~/foo/
#setopt extendedglob
_arguments '1:foo-cache:_files -W $cachedir  -g "fa_*"'



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