Ben Hutchings writes:
There is an alternative to using C-c, and that is M-#. This adds a '#' to the start of the line, commenting it out, and then behaves as if you pressed Return. The result is that the command is cancelled but still remains on-screen and in your history. You can then copy the command later using the mouse or keyboard.
Naturally, there is a zsh equivalent for this (there always is...): pound-insert. Quoth the manpage:
pound-insert
If there is no # character at the beginning of the buffer, add one to the beginning of each line. If there is one, remove a # from each line that has one. In either case, accept the current line. The INTERACTIVE_COMMENTS option must be set for this to have any usefulness.
So if you want the same for zsh, a simple
bindkey '^[#' pound-insert
is all you need.
Update:
Clint Adams noted another way to do (almost) the same.