我可以使 ZSH 的 Control-U 行为与 Bash 的行为相同吗?

发布于 2024-10-07 02:37:39 字数 152 浏览 0 评论 0原文

在 Bash 中, Ctrl+u 会清除从光标到行首的文本,并将该文本放入粘贴缓冲区,可以使用 Ctrl 粘贴+y

在Zsh中,它会清除文本,但不会将其放入缓冲区。

悲伤。

In Bash, Ctrl+u will clear from the cursor to the beginning of the line, and put that text into the paste buffer, which can be pasted with Ctrl+y.

In Zsh, it will clear the text, but does not put it into the buffer.

Sadness.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白衬杉格子梦 2024-10-14 02:37:39

只需两个 bindkey 命令即可轻松完成此操作:

bindkey '^U' backward-kill-line
bindkey '^Y' yank

值得注意的是,至少应在默认 Emacs 键盘映射中绑定“^Y”。

This can be done really easily with just two bindkey commands:

bindkey '^U' backward-kill-line
bindkey '^Y' yank

It may be worth noting that at least '^Y' should be bound in the default Emacs keymap.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文