gpt4 book ai didi

linux - 如何在 gnu screen 中绑定(bind)多个键,特别是使用箭头键

转载 作者:太空宇宙 更新时间:2023-11-04 03:40:11 26 4
gpt4 key购买 nike

首先,我使用 Opensuse 13.2 64 位和 Arch_Linux 64 位无法让绑定(bind)适用于它们中的任何一个(好吧,我想要的绑定(bind)),但我主要关注 Arch_Linux。另外,使用 openbox wm、xfce4-terminal。 (在 opensuse 中使用 konsole 和 gnome 3),我的 $TERM 在 ~/.bashrc 中设置为 xterm-256color,并在 opensuse 中使用 screen 时切换为 screen-256color,但奇怪的是在 Arch 中没有更改。

我想绑定(bind) C-a 向下:向下聚焦,C-a 向上:向上聚焦,C-a 向左:向左聚焦等等。让我们暂时专注于向下聚焦。我已经尝试了 ~/.screenrc 文件中的所有内容

bind "\E[B" focus down
bind "\EOB" focus down
bind "^[[B" focus down
bind "^[OB" focus down
bind "\033[B" focus down
bind "\033OB" focus down
bind "\033\133\102" focus down

bind j focus down # works fine

没有任何东西捕获向下箭头键。我可以使用以下内容

bind -k kd focus down

但是,我也想使用箭头绑定(bind)多个键,并且 -k 选项仅允许绑定(bind) 1 个键(或 shift + 左/右)。实际上,我很幸运,我什至可以使用 -k 选项,因为它没有记录。

现在我已经使用 infocmp 检查了我的 kd (termcap) 和 kcud1 (terminfo)

infocmp -1 | grep kcud1
kcud1=\EOB,
infocmp -1C | grep kd
:kd=\EOB:\

顺便说一句,这些符号可以查找 here for termcaphere for terminfo and its termcap equivelancies (实际上我想你可以使用:man terminfo)

当我使用 Ctrl-v 并按向下箭头时,我得到

 ^[[B

showkey -a
^[[B 27 0033 0x1b
91 0133 0x5b
66 0102 0x42

任何人都知道如何解决这个问题。我想知道为什么我不能在没有 -k termcap_name 的情况下使用 bind 和/或如何使用组合键(例如 ctrl/alt)和 termcap 名称。感谢您提供所有信息。

我也尝试过设置 termcapinfo,但没有成功。不认为我使用它是正确的。

termcapinfo * kd=\EOB
bind "\EOB" focus down

termcapinfo * kd=\E[B
bind "\E[B" focus down
etc...

最佳答案

GNU screen 似乎不允许多个键的绑定(bind)序列。

引用手册页:

bind [-c class] key [command [args]]

Bind a command to a key.
...
The key argument is either a single character, a two-character sequence of the form "^x" (meaning "C-x"), a backslash followed by an octal number (specifying the ASCII code of the character), or a backslash followed by a second character, such as "\^" or "\". The argument can also be quoted, if you like.
...

关于linux - 如何在 gnu screen 中绑定(bind)多个键,特别是使用箭头键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30006431/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com