Go to the previous, next section.

Key Binding

You may disagree with some of the default bindings (I know I do). The bind command allows you to redefine them to suit your preferences.

The bind command

Command: bind key [command [args]]

(none)
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. If no further argument is given, any previously established binding for this key is removed. The command argument can be any command (see section Command Index).

By default, most suitable commands are bound to one or more keys (see section Default Key Bindings; for instance, the command to create a new window is bound to C-c and c. The bind command can be used to redefine the key bindings and to define new bindings.

Examples of the bind command

Some examples:

bind ' ' windows
bind ^f screen telnet foobar
bind \033 screen -ln -t root -h 1000 9 su

would bind the space key to the command that displays a list of windows (so that the command usually invoked by C-a C-w would also be available as C-a space), bind C-f to the command "create a window with a TELNET connection to foobar", and bind ESC to the command that creates an non-login window with title `root' in slot #9, with a super-user shell and a scrollbackbuffer of 1000 lines.

Command Character

Command: escape xy

(none)
Set the command character to x and the character generating a literal command character to y (just like with the `-e' option). Each 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 default is `^Aa', but `"' is recommended by one of the authors.

Command: defescape xy

(none)
Set the default command characters. This is equivalent to the command escape except that it is useful for multiuser sessions only. In a multiuser session escape changes the command character of the calling user, where defescape changes the default command characters for users that will be added later.

Command: meta

(C-a a)
Send the command character (C-a) to the process in the current window. The keystroke for this command is the second parameter to the `-e' command line switch (see section Invoking Screen), or the escape .screenrc directive.

Command: command

(none)
This command has the same effect as typing the screen escape character (C-a). It is probably only useful for key bindings. See section Bindkey

Help

Command: help

(C-a ?)
Displays a help screen showing you all the key bindings. The first pages list all the internal commands followed by their bindings. Subsequent pages will display the custom commands, one command per key. Press space when you're done reading each page, or return to exit early. All other characters are ignored, except for the command character, which will exit the help display and begin a command. See section Default Key Bindings.

Bindkey

Command: bindkey [opts] [string [cmd args]]

(none)
This command manages screen's input translation tables. Every entry in one of the tables tells screen how to react if a certain sequence of characters is encountered. There are three tables: one that should contain actions programmed by the user, one for the default actions used for terminal emulation and one for screen's copy mode to do cursor movement. See section Input Translation for a list of default key bindings.

If the `-d' option is given, bindkey modifies the default table, `-m' changes the copy mode table and with neither option the user table is selected. The argument `string' is the sequence of characters to which an action is bound. This can either be a fixed tring or a termcap keyboard capability name (selectable with the `-k' option).

Some keys on a VT100 terminal can send a different string if application mode is turned on (e.g. the cursor keys). Such keys have two entries in the translation table. You can select the application mode entry by specifying the `-a' option.

The `-t' option tells screen not to do intercharacter timing. One cannot turn off the timing if a termcap capabilty is used.

`cmd' can be any of screen's commands with an arbitrary number of `args'. If `cmd' is omitted the keybinding is removed from the table.

Bindkey Examples

Here are some examples of keyboard bindings:

bindkey -d
Show all of the default key bindings. The application mode entries are marked with [A].

bindkey -k k1 select 1
Make the "F1" key switch to window one.

bindkey -t foo stuff barfoo
Make `foo' an abrevation of the word `barfoo'. Timeout is disabled so that users can type slowly.

bindkey "\024" mapdefault
This keybinding makes `C-t' an escape character for keybindings. If you did the above `stuff barfoo' binding, you can enter the word `foo' by typing `C-t foo'. If you want to insert a `C-t' you have to press the key twice (i.e. escape the escape binding).

bindkey -k F1 command
Make the F11 (not F1!) key an alternative screen escape (besides `C-a'). Note that `F11 F11' does not work in the current release of screen.

Bindkey Control

Command: mapdefault

(none)
Tell screen that the next input character should only be looked up in the default bindkey table.

Command: mapnotnext

(none)
Like mapdefault, but don't even look in the default bindkey table.

Command: maptimeout timo

(none)
Set the intercharacter timer for input sequence detection to a timeout of timo ms. The default timeout is 300ms. Maptimeout with no arguments shows the current setting.

Go to the previous, next section.