由于 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-line
是readline
提供的函数。同时,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/