On Thu, Nov 12, 2020 at 9:41 AM Thomas Lauer <thomas.lauer@virgin.net> wrote:

This works as expected. However, if I rename it to md5() { ... }, zsh hangs when I type
md5 a<tab> to expand a filename.

Zsh is invoking the completion for the system default "md5" command (sometimes found as /sbin/md5).  That completion attempts to run "md5 --version" to find out whether it is completing for GNU md5 or some other variant.  Your function doesn't handle that, and invokes xclip in the background, which hangs.