Search code examples
bashzsh

Can I make Control-U behavior be the same for ZSH as it is for Bash?


In Bash, Ctrl+u will clear from the cursor to the beginning of the line, and put that text into the paste buffer, which can be pasted with Ctrl+y.

In Zsh, it will clear the text, but does not put it into the buffer.

Sadness.


Solution

  • This can be done really easily with just two bindkey commands:

    bindkey '^U' backward-kill-line
    bindkey '^Y' yank
    

    It may be worth noting that at least '^Y' should be bound in the default Emacs keymap.