bash – How to remove console content from cursor to beginning?

Question:

Until recently I used Bash. There, you can remove all the content of the line from where the cursor is to the beginning of the line by pressing Ctrl + U.

$ hola que tal estas
          ^
$ tal estas            # Ctrl+U
  ^

And so indicates the Bash manual in 8.4.4 Killing And Yanking :

unix-line-discard (Cu)

Kill backward from the cursor to the beginning of the current line.

However, I now use zsh ( Oh My Zsh specifically) and this functionality has disappeared. Now when I press Ctrl + U the entire line is removed. If I do Ctrl + W words are eliminated in the following way:

 $ hola que_tal estas
               ^
 $ hola que_ estas        # Ctrl+U
            ^
 $ hola  estas            # Ctrl+U
        ^

Does anyone know what I should configure so that Ctrl + U re-removes everything from the cursor to the beginning of the line?

Answer:

Apparently Ctrl + U in zsh fulfills the function kill-whole-line by default, what you need is to do a backward-kill-line , try adding this to your .zshrc :

bindkey \^U backward-kill-line

It is worth mentioning that the list of commands (or widgets) can be found in the zshzle zshzle in the STANDARD WIDGETS section.

For further reference:

Scroll to Top