在 MySQL 屏幕中拥有类似 Vim 的 K
This question is based on this thread.
Problem: to access MySQL's manual when the cursor is at the beginning of the word by
Ctrl-A Esc Ctrl-m
where m reminds about Mysql.
How can you build a Vim-like K in Screen for MySQL's manuals?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
假设您已经安装了 MySQL 文档站点 中的手册页:
将以下内容放入
/ path/to/mysql-help.screen
:然后将其添加到您的
~/.screenrc
然后您的键绑定应该可以工作。 如果您使用不同的程序来显示
除了
man
之外的手册,您必须相应地更改脚本。我在上面的链接中找到的 mysql 手册页仅包含文档
对于以下命令:
您也可以想要考虑添加
到您的
.screenrc
中,这样,如果您使用它无法识别的术语运行手册,screen 不会自动关闭窗口(并隐藏错误消息)。Assuming you've installed the man pages from MySQL's documentation site:
Put the following in
/path/to/mysql-help.screen
:Then add this to your
~/.screenrc
Then your keybinding should work. If you're using a different program to display
the manual other than
man
, you'll have to change the script accordingly.The
man
pages for mysql that I found at the link above only include documentationfor the following commands:
You may also want to consider adding
to your
.screenrc
, so that if you run the manual on a term that it doesn't recognize, screen doesn't automatically close the window (and hide the error message).虽然我不确定如何开始为 vim 创建一个包装器来完全执行您想要的操作,但我可能会建议您如何使用 vim 内置的函数实现类似的效果。
<代码>:!将允许您使用与 vim 的 K 命令类似的界面来运行 shell 命令。 这可能不是最干净的方法,但是通过使用
:!
你应该能够快速调用给定术语的 MySQL 手册,而无需完全离开 vim。如果您确实需要为 vim 编写自己的插件,这篇文章也许能为您提供一些指导和从哪里开始的指导。
我希望这有帮助!
While I'm not sure how to start you off creating a wrapper for vim to do exactly what you want, I might make a suggestion on how you can achieve a similar effect with a function built into vim.
:! <command>
will allow you to run shell commands with a similar interface to vim's K command. It might not be the cleanest way to do it, but by using:!
you should be able to call the MySQL manuals for a given term quickly without completely leaving vim.If you really need to write your own plugin for vim, this article might be able to give you some pointers and a handhold on where to start.
I hope this helps!
我喜欢回收我的手册页,这样我就可以轻松阅读手册。
我建议对 Rampion 的命令进行以下改进。
Rampion
我
我的代码为您提供了手册底部的百分号。
I love to recycle my Man -pages such that I can read easily manuals.
I suggests the following improvement to Rampion's command.
Rampion
Me
My code gives you the percent sign to the bottom of a manual.