Go to the first, previous, next, last section, table of contents.


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 [-c class] 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).

If a command class is specified via the -c option, the key is bound for the specified class. Use the command command to activate a class. Command classes can be used to create multiple command keys or multi-character bindings.

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 superuser shell and a scrollback buffer of 1000 lines.

bind -c demo1 0 select 10
bind -c demo1 1 select 11
bind -c demo1 2 select 12
bindkey "^B" command -c demo1

makes C-b 0 select window 10, C-b 1 window 11, etc.

bind -c demo2 0 select 10
bind -c demo2 1 select 11
bind -c demo2 2 select 12
bind - command -c demo2

makes C-a - 0 select window 10, C-a - 1 window 11, etc.

Command Character

Command: escape xy
(none)
Set the command character to x and the character generating a literal command character (by triggering the meta command) to y (similar to 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 [-c class]
(none)
This command has the same effect as typing the screen escape character (C-a). It is probably only useful for key bindings. If the `-c' option is given, select the specified command class. See section The bind command, 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. If the `-c' option is given, display all bound commands for the specified command class. 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 inter-character timing. One cannot turn off the timing if a termcap capability is used.

`cmd' can be any of screen's commands with an arbitrary number of `args'. If `cmd' is omitted the key-binding 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 abbreviation of the word `barfoo'. Timeout is disabled so that users can type slowly.

bindkey "\024" mapdefault

This key-binding makes `C-t' an escape character for key-bindings. 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').

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 first, previous, next, last section, table of contents.