0

First off, I'm using Opensuse 13.2 64-bit and also Arch_Linux 64-bit Can't get the bind to work for either of them (well, the binds that I want), but I'm mostly focused on the Arch_Linux. Also, using openbox wm, xfce4-terminal. ( in opensuse using konsole and gnome 3) and my $TERM is set to xterm-256color in my ~/.bashrc and is switched to screen-256color when using screen in opensuse, but strangely is not changed in Arch.

I want to bind C-a down: to focus down, C-a up: to focus up, C-a left: to focus left etc.. Lets just focus on focus down for the moment. I've tried everything in my ~/.screenrc file

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

Nothing catches the down arrow key. I CAN use the following

bind -k kd focus down

however, I also want to bind multiple keys using the arrows and AFAIK the -k option only allows binding 1 key (or shift + left/right) . Actually I'm lucky I can even use the -k option since it is not documented.

Now I've checked my kd (termcap) and kcud1 (terminfo) using infocmp

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

and BTW these symbols can be looked up here for termcap and here for terminfo and its termcap equivelancies (actually I guess you can just use: man terminfo)

when I use Ctrl-v and press down arrow I get

 ^[[B

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

Anyone know how to go about this. I want to know why I can't use bind without the -k termcap_name and/or how to use combo of keys(such as ctrl/alt) and termcap names. Thanks for all and any info.

I've tried setting termcapinfo also with no luck. don't think I'm using it right.

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

termcapinfo * kd=\E[B
bind "\E[B" focus down
etc...
Thomas Dickey
  • 43,185
  • 7
  • 51
  • 88
Craig
  • 135
  • 9

2 Answers2

0

It appears that GNU screen doesn't permit binding sequences of multiple keys.

Quoting the man page:

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.
...

Keith Thompson
  • 230,326
  • 38
  • 368
  • 578
  • I think you missed something..."two-character sequence of the form "^x"(meaning "C-x"). But my question is centered around getting bind to bind to cursor key down, which IS one key. My next step will be to get it to bind to C-Down. Thanks – Craig May 03 '15 at 00:46
  • 1
    Cursor key down is one *key*, but it sends multiple characters (more than two). So you cannot do what you are asking for. – Thomas Dickey May 03 '15 at 01:22
0

As said in this answer, try:

bindkey "^A^[OB" focus down

The vim trick is really helpful to get the code for the combinations you want (for example, if you wanted the combo Ctrla Ctrldown instead of Ctrla down, this would be ^[[1;5B instead of ^[OB).

Credit should go to koyae for the original answer.

MoonSweep
  • 101
  • 4