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

Re: completion function with compadd

On Jan 20,  7:20pm, Eric Smith wrote:
} Is it possible to complete on words within that file.
} The example I am looking for is my mutt aliases

Is there something not working for you if you use the mutt completer
that's included in the zsh distribution?

Theoretically, it handles mutt alias files just fine.  If for some
reason it doesn't, you can create your own plugin function called
"_email-mutt" to do the work.  (Unfortunately the interface to the
plugin is rather poorly documented, but there are examples in the
Completion/Unix/Type/_email_addresses file.)

Just be sure you define the plugin function before you load the
_email_addresses file.  (Autoloading both should work fine.)

} mutt alice@xxxxxxxxxxxxxxxx
} and not
} mutt alias aw "Alice in Wonderland" <alice@xxxxxxxxxxxxxxxx>

For that specific example, assuming that you've somehow assigned the
line from the file to the variable $line, you'd want something like

	compadd ${line/(#b)*<(*)>/$match[1]}

(which assumes extendedglob is set, but it always is in completion).

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