这个问题是基于 这个线程.

问题: 当光标处于单词开头时,访问mySQL的手册

Ctrl-A Esc Ctrl-m

M提醒 mYSQL。

您如何在MySQL的手册中在屏幕上构建类似VIM的K?

有帮助吗?

解决方案

假设您已经安装了男人页面 MySQL的文档网站:

放在以下 /path/to/mysql-help.screen:

# mysql-help.screen

# prevent messages from slowing this down
msgminwait 0
# copy term starting at cursor
copy
stuff " e "
# write term to a file
writebuf /tmp/screen-copied-term
# open that file in man in a new screen window
# (use `read` to pause on error, so user can see error message)
screen /bin/sh -c 'man `cat /tmp/screen-copied-term` || read'
# turn message waiting back on
msgminwait 1

# vi: ft=screen

然后将其添加到您的 ~/.screenrc

# Have CTRL-A ESC put you in a mode to accept commands in the 'escaped' class
bind \033 command -c escaped
# add CTRL-M as an 'escaped' class command to run the given screen script
bind -c escaped ^M source /path/to/mysql-help.screen

然后,您的钥匙限制应该起作用。如果您使用其他程序以显示手册 man, ,您必须相应地更改脚本。

man 我在上面链接上发现的MySQL的页面仅包括以下命令的文档:

mysqlbug mysqlhotcopy perror mysqldump resolveip mysqltest_embedded mysql_setpermission mysql_client_test mysql_find_rows mysql_fix_privilege_tables mysql_waitpid mysql_config mysql_client_test_embedded myisampack replace msql2mysql make_win_bin_dist my_print_defaults mysql-stress-test.pl mysqlaccess mysql_secure_installation mysql.server mysql_convert_table_format mysql_zap mysql_fix_extensions myisamlog myisam_ftdump mysqlbinlog mysql_install_db resolve_stack_dump mysqlslap mysql-test-run.pl mysqld_safe mysqladmin mysqlshow mysql_tzinfo_to_sql mysqltest mysqlbackup mysqld_multi mysql mysqldumpslow mysqlcheck mysql_upgrade mysqlimport comp_err mysqld myisamchk innochecksum

您可能还想考虑添加

zombie kr

给你 .screenrc, ,因此,如果您在无法识别的术语中运行手册,则屏幕不会自动关闭窗口(并隐藏错误消息)。

其他提示

虽然我不确定如何开始为VIM创建包装器以完成您想要的工作,但我可能会建议如何使用内置在VIM中的功能实现相似的效果。

:! <command> 将允许您运行具有与VIM K命令相似的接口的Shell命令。这可能不是最干净的方法,而是使用 :! 您应该能够在不完全离开VIM的情况下快速致电MySQL手册。

如果您真的需要为VIM编写自己的插件, 本文 也许能够给您一些指针和关于从哪里开始的手段。

我希望这有帮助!

我喜欢回收我的男人页面,以便可以轻松阅读手册。我建议对Rampion的命令进行以下改进。

横冲直撞

screen /bin/sh -c 'man `cat /tmp/screen-copied-term` || read'

screen /bin/sh -c 'man `cat /tmp/screen-copied-term` > /tmp/manual | less /tmp/manual'

我的代码为您提供了手册底部的百分比符号.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top