How do I bind the keys Tab and ShiftTab in screen? My problem is that I don’t know what to pass to the screen bind
command to designate these keystrokes.
BTW, I’m aware of GNU screen: move between regions but the answer is not there.
All of the following fail with the error -X: bind: character, ^x, or (octal) \032 expected
:
screen -X bind "\033[Z" focus up
screen -X bind "^[[Z" focus up
screen -X bind "\t" focus up
screen -X bind \033[Z focus up
screen -X bind ^[[Z focus up
screen -X bind \t focus up
Same thing if I hit CtrlA: to input the command.
Best Answer
Contrary to
bindkey
where you can specify character sequences, withbind
, the only way is by usingbind -k CAP
where CAP is atermcap
key capability.For instance,
works to bind the sequence of character sent upon Up to
focus up
. For backtab, that should be:Unfortunately, for some reason, it doesn't see to work. Not sure why. My first interpretation was wrong. It sounds like it has something to do with with
ncurses
not handling the termcap equivalent ofkcbt
correctly:(kcbt is no translated to kB).
If I add to my
~/.screenrc
:That is, if I tell
screen
that whatever the host termincal (*
), F63 (kr
) sends\E[Z
, and bind F63 tofocus up
, then that works. However note that pressing Shift+Tab now sends within screen\EOC
, which is the character sequence that the terminal emulator that screen implements (as opposed to the host terminal) sends upon F63.