Zsh中的哪个快捷方式与Bash中的Ctrl-U相同? [英] Which shortcut in Zsh does the same as Ctrl-U in Bash?

查看:80
本文介绍了Zsh中的哪个快捷方式与Bash中的Ctrl-U相同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆