在MySQL屏幕上具有Vim样的K [英] To have Vim-like K in Screen for MySQL
问题描述
此问题基于此线程.
问题::当光标位于单词by的开头时,访问MySQL的手册
Problem: to access MySQL's manual when the cursor is at the beginning of the word by
Ctrl-A Esc Ctrl-m
其中m提醒有关 M ysql.
where m reminds about Mysql.
如何在Screen中为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
以外的手册,则必须相应地更改脚本.
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.
我在上面的链接中找到的mysql的man
页仅包含文档
用于以下命令:
The man
pages for mysql that I found at the link above only include documentation
for the following commands:
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
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
mysqldumpslow
mysqlcheck
mysql_upgrade
mysqlimport
comp_err
mysqld
myisamchk
innochecksum
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
,因此,如果您以无法识别的术语运行手册,则屏幕不会自动关闭窗口(并隐藏错误消息).
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).
这篇关于在MySQL屏幕上具有Vim样的K的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!