Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

bash

zsh

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?

like image 524
Kent Avatar asked Aug 14 '10 13:08

Kent


People also ask

Which is better bash or zsh?

Zsh is built on top of bash thus it has additional features. Zsh is the default shell for macOS and Kali Linux. Zsh provides the user with more flexibility by providing various features such as plug-in support, better customization, theme support, spelling correction, etc.


1 Answers

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.

like image 113
Gilles 'SO- stop being evil' Avatar answered Sep 21 '22 05:09

Gilles 'SO- stop being evil'