在 Zsh 中为 Info 创建键盘快捷键?
有以下键盘快捷键,
Zsh 对于 Man Esc+h
我希望有一个类似的键盘快捷键,用于诸如
Esc+ 等信息i
如何为信息制作这样的键盘快捷键?
Zsh has the following keyboard shortcut for Man
Esc+h
I would like to have a similar keyboard shortcut for info such as
Esc+i
How can you make such a keyboard shortcut for Info?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该可以解决问题:
只需将其剪切并粘贴到 shell 中进行尝试,然后添加到您的 .zshrc 以获得永久效果。
解释一下代码:总体思路是我们首先定义一个名为“run_info”的小部件,用同名的函数实现。 它获取命令行缓冲区并在开头添加“info”。 然后它接受命令行(与按 Enter 相同)。 最后,小部件被映射到键盘快捷键。
您可以阅读 zshzle(1) 手册页以获取有关此内容如何工作的更多信息。
This should do the trick:
Just cut'n paste that into a shell to try it out, and add to your .zshrc for permanent effect.
To paraphrase the code: the general idea is that we first define a widget called "run_info", implemented with a function with the same name. It takes the command line buffer and adds "info " to the beginning. Then it accepts the command line (same as pressing Enter). Finally, the widget is mapped to the keyboard shortcut.
You can read the zshzle(1) man page for more info on how this stuff works.