Strict Standards: Declaration of action_plugin_loglog::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/public/screen/lib/plugins/loglog/action.php on line 15

Strict Standards: Declaration of action_plugin_captcha::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/public/screen/lib/plugins/captcha/action.php on line 0
GNU screen [interface]

This set of commands is mostly about customizing screen's interface,
in terms of keybindings. The most important command is probably
escape, which lets you change the default screen
prefix escape character. emacs users, in particular, will want to use
a different prefix, since C-a is “beginning of line” in emacs.

The bind and bindkey commands allow you
to add or redefine screen keybindings. Both can associate arbitrary
screen commands with specific keypresses. bind
defines keys in screen's main command class, so the command
”bind K kill” would cause the key sequence
C-a K to trigger the kill command.
bindkey is more general; it can bind commands to any
keypress, not just ones preceded by C-a. bindkey can
also modify the keypresses used in copy mode.

Technically, what bindkey does is modify one of
screen's three input translation tables. Normally, when you press a
key, screen checks the user translation table to see if they key is
there; if it is, then the bound action is taken. bindkey
changes the user translation table by default, and most arbitrary
keybindings should go there. If the user translation table doesn't have
an entry for the key pressed, screen then checks the default
translation table; if nothing is there, the keypress gets sent to the
window. The default translation table is used for keybindings that affect
screen's terminal emulation, like the particular escape sequence to
send for a function key.

The third input translation table is for copy mode. You can
use it to change the keys used in that mode. This works a little
differently than the other modes, because there aren't commands for the
things you can do in copy mode. You can, of course, bind any of
screen's normal commands, but if you want to trigger any
copy-mode-specific commands, you have to use stuff and
stuff the key sequence for the action you want to take. You can use this
functionality to remap copy mode key bindings, but that's better done with
the markkeys command; bindkey is more
useful when you want to chain several actions together.

bindkey updates the user table by default, and the
default and copy mode tables with the -d and -m options,
respectively. If you call bindkey without giving it a
keybinding, it will display the current bindings for the selected mode.

Command classes are how you can implement multi-key bindings in
screen. Basically, screen has to do something for every key
the user presses. (Modifiers don't count; C-a is considered a single
keypress.) To effect a multi-key sequence, you have to tell screen
that the first keypress activates a command class, where that command
class contains a binding for the next key, and so on. This is effectively
how normal screen keybindings work: the C-a activates the default
command class, which contains all of the default bindings, plus any that
you've added with bind.

You “activate a command class” with the command command.
Without any arguments, it activates the default command class (just like
C-a does). Its -c argument activates whatever class is provided
to it. Similarly, bind's -c option makes a binding
in the specified command class.

(To be fair, command classes are just the most flexible way to implement
multi-key bindings in screen. The bindkey command
will bind commands to strings as well as single characters. If the
characters in the string arrive quickly enough (faster than
maptimeout), they will trigger the binding. The -t
option will even disable the timeout.)

Sometimes you don't want to activate a keybinding. That's where
mapdefault comes in; it causes the next keypress to not
be checked against the user input translation table (see
bindkey Tables above). This bypassess all screen
keybindings except the ones needed for its terminal emulation. If you
need to bypass the default input translation table too, use
mapnotnext.

vi users might want to use the escape character as their prefix key.
When doing that, you have to decide whether two escapes in a row will call
other (to switch to the most recently visited window) or
meta (to send an escape character to the window). Here's
an example of each:

# ESC ESC calls meta
escape ^[^[
# ESC o calls other
bind o other

# ESC [ calls meta
escape ^[[
# ESC ESC calls other by default

emacs users will probably want to remap the escape character just
because it interferes with C-a in emacs. One option is to use
C-z instead, as it's close to C-a and screen lets you open new
programs in new windows, rather than having to suspend the current program
first:

It's often useful to have a quote key that sends the next keypress through
unintercepted. Here's how to accomplish that:

bind ^Q mapdefault

With that, you can press C-a C-q another-key and another-key
will be passed through to the window (unless it's affected by the default
input translation table, but you generally want those to still be mapped,
because they affect screen's terminal definitions).

markkeys is used for the single-character bindings, while
bindkey is used for the multi-character keys. (You can't
specify a meta key, but you can use the combination with escape that is
equivalent. xterm can even be set up to send an escape character when
a meta-key combination is pressed.)

In xterm, shift-PgUp and shift-PgDn move through the terminal's
scrollback buffer. screen keeps a separate scrollback buffer for each
window, so this example lets you use those keypresses to move around
screen's scrollback buffer.

First, you need to disable scrolling in xterm, so this goes in your
.Xresources file: