Clear the characters before the current cursor position in Zsh

Solution 1:

Bash and zsh work slightly different here. In zsh, CTRL + U clears the entire line instead.

In your configuration .zsh put this lines:

bindkey -e
bindkey \^U backward-kill-line

You can use

$ bindkey

to list all of your keyboard shortcuts in zsh.

BTW: in bash you will print all bindkey with the following command:

bind -P

So no cheat sheets are necessary!

Solution 2:

In zsh, Alt+W deletes the from the cursor back to the beginning of the current word.