For those confined to a hardware terminal, these commands provide a cut and paste facility more powerful than those provided by most windowing systems.
vi
-like full screen editor is active, with controls as
outlined below.
crlf
is off by default.
When no parameter is given, the state is toggled.
scrollback
command except that the default setting
for new windows is changed. Defaults to 100.
markkeys
h=^B:l=^F:$=^E
would set some keys to be more familiar to emacs
users.
If your terminal sends characters, that cause you to abort copy mode,
then this command may help by binding these characters to do nothing.
The no-op character is `' and is used like this: markkeys @=L=H
if you do not want to use the `H' or `L' commands any longer.
As shown in this example, multiple keys can be assigned to one function
in a single statement.
h, j, k, l move the cursor line by line or column by column.
0, ^ and $ move to the leftmost column or to the first or last non-whitespace character on the line.
H, M and L move the cursor to the leftmost column of the top, center or bottom line of the window.
+ and - move the cursor to the leftmost column of the next or previous line.
G moves to the specified absolute line (default: end of buffer). | moves to the specified absolute column.
w, b, e move the cursor word by word. C-u and C-d scroll the display up/down by the specified amount of lines while preserving the cursor position. (Default: half screenfull).
C-b and C-f move the cursor up/down a full screen.
g moves to the beginning of the buffer.
% jumps to the specified percentage of the buffer.
Note that Emacs-style movement keys can be specified by a .screenrc
command. (markkeys "h=^B:l=^F:$=^E"
) There is no simple method for
a full emacs-style keymap, however, as this involves multi-character codes.
The copy range is specified by setting two marks. The text between these marks will be highlighted. Press space to set the first or second mark respectively.
Y and y can be used to mark one whole line or to mark from start of line.
W marks exactly one word.
Any command in copy mode can be prefixed with a number (by pressing digits 0...9) which is taken as a repeat count. Example: C-a C-[ H 10 j 5 Y will copy lines 11 to 15 into the paste buffer.
/ vi
-like search forward.
? vi
-like search backward.
C-a s emacs
style incremental search forward.
C-r emacs
style reverse i-search.
There are, however, some keys that act differently here from in
vi
. Vi
does not allow to yank rectangular blocks of text,
but screen
does. Press
c or C to set the left or right margin respectively. If no
repeat count is given, both default to the current cursor position.
Example: Try this on a rather full text screen:
C-a [ M 20 l SPACE c 10 l 5 j C SPACE.
This moves one to the middle line of the screen, moves in 20 columns left,
marks the beginning of the paste buffer, sets the left column, moves 5 columns
down, sets the right column, and then marks the end of
the paste buffer. Now try:
C-a [ M 20 l SPACE 10 l 5 j SPACE
and notice the difference in the amount of text copied.
J joins lines. It toggles between 3 modes: lines separated by a
newline character (012), lines glued seamless, or lines separated by a
single space. Note that you can prepend the newline character with
a carriage return character, by issuing a set crlf on
.
v is for all the vi
users who use :set numbers
- it
toggles the left margin between column 9 and 1.
a before the final space key turns on append mode. Thus the contents of the paste buffer will not be overwritten, but appended to.
A turns on append mode and sets a (second) mark.
> sets the (second) mark and writes the contents of the paste buffer
to the screen-exchange file (`/tmp/screen-exchange' per default)
once copy-mode is finished. See section Screen-Exchange.
This example demonstrates how to dump the
whole scrollback buffer to that file:
C-a [ g SPACE G $ >.
C-g gives information about the current line and column.
x exchanges the first mark and the current cursor position. You can use this to adjust an already placed mark.
@ does nothing. Absolutely nothing. Does not even exit copy mode.
All keys not described here exit copy mode.
copy
, history
and readbuf
commands.
Other registers can be filled with the register
, readreg
and
paste
commands.
If paste
is called with a second argument, the contents of the specified
registers is pasted into the named destination register rather than
the window. If `.' is used as the second argument, the display's paste
buffer is the destination.
Note, that paste
uses a wide variety of resources: Usually both, a
current window and a current display are required. But whenever a second
argument is specified no current window is needed. When the source specification
only contains registers (not the paste buffer) then there need not be a current
display (terminal attached), as the registers are a global resource. The
paste buffer exists once for every user.
paste
command.
If the slowpaste value is nonzero text is written character by character.
screen
will pause for msec milliseconds after each write
to allow the application to process the input. only use slowpaste
if
your underlying system exposes flow control problems while pasting large
amounts of text.
readbuf
reads the screen-exchange file
into the paste buffer.
The following example will paste the system's password file into
the screen window (using register p, where a copy remains):
C-a : readreg p /etc/passwd C-a : paste p
readreg
instead.
paste
instead.
screen
input queue. If no argument is given you are prompted for a
register name. The text is parsed as if it had been typed in from the user's
keyboard. This command can be used to bind multiple actions to a single key.
paste
command, but with much less overhead.
You cannot paste large buffers with the stuff
command. It is most
useful for key bindings. See section Bindkey
screen
reverts
to the default of `/tmp/screen-exchange'. The following example
will paste the system's password file into the screen window (using the
paste buffer, where a copy remains):
C-a : bufferfile /etc/passwd C-a < C-a ] C-a : bufferfile
screen
users on the same host. See also
C-a ESC (see section Copying).
csh
has the command !!
to repeat
the last command executed. screen
provides a primitive way of
recalling "the command that started ...": You just type the first
letter of that command, then hit C-a { and screen
tries to
find a previous line that matches with the prompt character to the left
of the cursor. This line is pasted into this window's input queue. Thus
you have a crude command history (made up by the visible window and its
scrollback buffer).