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

Re: completion for printf-style format strings



Felix Rosencrantz wrote:
> Does anyone have code to perform completion of printf-style format strings?
> 
> I think it was suggested that it might be possible to do with 
> _regex_arguments. but not sure if there is an example somewhere or a
> utility function.

It wouldn't be possible with _regex_arguments. _regex_arguments is only
useful when completing a single command-line argument in full. It never
uses compset -P/-S to cut the current word down into chunks.

You would probably want to use patterns a lot though. Basically you need
to remove any literal characters and complete format specifications from
the front of the word. Then you can deal with any partially complete
format specifications. What might be good is to make it sufficiently
general so as to be usable for things like strftime too.

Oliver



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