On Thu, Jan 26, 2023 at 06:34:24PM +0100, Vincent Lefevre wrote: > About this, Ctrl-U is just a shell feature. Contrary to bash, it is > not really usable in zsh to erase long pastes (unless one changes > the default bindings). But Ctrl-C is fine in zsh.
Ctrl-U is bound to "kill" at the terminal level (e.g. stty(1)). It's more than just a shell feature. You can use it in any setting where a terminal is in "canonical mode", e.g. "cat" with no arguments reading from a terminal, or a terminal's login prompt. I don't know a lot about zsh, but I ran it, typed some letters, and pressed Ctrl-U, and they were all erased as expected. One difference that I did notice in zsh is that its handling of Ctrl-U after a bracketed paste is different from bash's. I used "seq 3 | xclip -i" to load three harmless lines into the paste selection, and then pasted it into zsh, and into bash, and pressed Ctrl-U in each of them. In the zsh case, only the third line was erased, and the first 2 were still there, and were executed when I pressed Enter. In bash, all 3 lines were erased, and Enter didn't execute any of them. Whether that's a bug in zsh, I can't say.