Zsh中的哪个快捷方式与Bash中的Ctrl-U相同? [英] Which shortcut in Zsh does the same as Ctrl-U in Bash?
问题描述
在Bash中,当我键入命令时,按 Ctrl + U ,将从行首到光标的所有字符都将被删除.但是,在zsh中,如果按 Ctrl + U ,则整行都消失了.
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.
在Zsh中与在Bash中如何做相同的事情?
How to do the same in Zsh as in Bash?
推荐答案
听起来您想将 Ctrl + U 绑定到 backward-kill-line
而不是 kill-whole-line
,因此将其添加到您的 .zshrc
:
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
内置的 bindkey
和可用的编辑命令(小部件")在 zshzle
手册页中进行了记录.
The bindkey
builtin and the available editing commands ("widgets") are documented in the zshzle
man page.
这篇关于Zsh中的哪个快捷方式与Bash中的Ctrl-U相同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!