bash - 如何在 zsh 中获取 Bash 的恢复行

标签 bash zsh key-bindings

由于 macOS 默认更改为 zsh,我尝试更新它的键绑定(bind)。

bash中我可以使用以下命令:

bind '"\C-a": revert-line' # Revert/resets the changed history line while you are on it with the the cursor

我在 zsh 上没有找到类似的功能.

bindkey "^a" what-to-put-here 

你知道如何用zsh来完成它吗?

最佳答案

revert-linereadline提供的函数。同时,ZSH 不依赖于 readline。 ZSH 在命令行中有自己的编辑器,称为 ZLE(ZSH Line Editor)。

ZLE 内置函数中似乎没有重置所有功能。如我错了请纠正我。

撤消可能是您的替代方案。

undo

Incrementally undo the last text modification. When called from a user-defined widget, takes an optional argument indicating a previous state of the undo history as returned by the UNDO_CHANGE_NO variable; modifications are undone until that state is reached, subject to any limit imposed by the UNDO_LIMIT_NO variable.

bindkey "^a" undo

关于bash - 如何在 zsh 中获取 Bash 的恢复行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58286906/

相关文章:

linux - Bash 并发作业卡住了

bash - 无法理解 bash 脚本中的组合执行和重定向

node.js - Bash 导出变量但仅适用于当前命令

路径中间的 zsh glob 限定符

emacs - 为什么键绑定(bind) M-S-t 失败而 C-S-t 有效?

sublimetext3 - 崇高的文字 : how to add a key binding to hex_viewer package command

bash - 尝试在 cygwin 中运行脚本时出错

linux - list 命令 grep 当前日期 仅输出文件名

bash - 这个访谈项目表明什么水平的专业知识?取消设置 foo;回音栏 |读 foo; echo $foo

xcode - XCode 4 中的多行光标移动