Which shortcut in Zsh does the same as Ctrl-U in Bash?

BashZsh

Bash Problem Overview


In Bash, when I am typing a command, I press Ctrl+U, all characters from the beginning of the line to the cursor are going to be removed. However, in zsh, if I pressed Ctrl+U, the whole line is gone.

How to do the same in Zsh as in Bash?

Bash Solutions


Solution 1 - Bash

It sounds like you'd like for Ctrl+U to be bound to backward-kill-line rather than kill-whole-line, so add this to your .zshrc:

bindkey \^U backward-kill-line

The bindkey builtin and the available editing commands (“widgets”) are documented in the zshzle man page.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKentView Question on Stackoverflow
Solution 1 - BashGilles 'SO- stop being evil'View Answer on Stackoverflow