GNU screen custom key bindings format

4.2k views Asked by At

I am trying to add key bindings to the .screenrc file for making a lot of things easier. So far I have understood the following pattern

bindkey "^k" eval "copy" "stuff k"    # enter copy mode and move up one line

Here ^ corresponds to the Ctrl key, eval is evaluate while "copy" signifies entry into the copy mode. stuff, I am assuming, is like an escape character which helps screen understand that k is a command inside copy mode. Now I can enter the copy mode with <Ctrl-k> and escape it using any unused key like ] or Esc.

I want to understand the key binding format a little better and need some source like :h keycodes in VIM which shows all the possible key bindings that VIM understands.

Is there a command or help page that can tell me what key bindings screen can understand? For example, how do we know how screen understands PageUp/PageDown so that we can map it to some function?

1

There are 1 answers

0
bonsaiviking On BEST ANSWER

Take a look at the Input Translation section of the manpage. There's a table there with all the termcap names for the keys, which you can use like bindkey -k k5 other (this binds the F5 key to the other command for toggling between active windows).

Also, look at the bind command, which binds keys which are entered from command mode (after pressing Ctrl-a).

The stuff command sends its arguments as though the user typed them at the prompt. I have used this in the past to control multiple shells on multiple machines by "stuffing" keystrokes into all my windows.