[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.1 Copying

Command: copy

(C-a [, C-a C-[, C-a ESC)
Enter copy/scrollback mode. This allows you to copy text from the current window and its history into the paste buffer. In this mode a vi-like full screen editor is active, with controls as outlined below.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.1.1 CR/LF

Command: crlf [state]

(none)
This affects the copying of text regions with the C-a [ command. If it is set to `on', lines will be separated by the two character sequence `CR'/`LF'. Otherwise only `LF' is used. crlf is off by default. When no parameter is given, the state is toggled.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.1.2 Scrollback

Command: defscrollback num

(none)
Same as the scrollback command except that the default setting for new windows is changed. Defaults to 100.

Command: scrollback num

(none)
Set the size of the scrollback buffer for the current window to num lines. The default scrollback is 100 lines. Use C-a i to view the current setting.

Command: compacthist [state]

(none)
This tells screen whether to suppress trailing blank lines when scrolling up text into the history buffer. Turn compacting `on' to hold more useful lines in your scrollback buffer.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.1.3 markkeys

Command: markkeys string

(none)
This is a method of changing the keymap used for copy/history mode. The string is made up of oldchar=newchar pairs which are separated by `:'. Example: The command 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.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.1.4 Movement Keys

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.

B, E move the cursor WORD by WORD (as in vi).

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.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.1.5 Marking

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.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.1.6 Repeat Count

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.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.1.7 Searching

/ vi-like search forward.

? vi-like search backward.

C-a s emacs style incremental search forward.

C-r emacs style reverse i-search.

Command: ignorecase [state]

(none)
Tell screen to ignore the case of characters in searches. Default is off.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.1.8 Specials

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 4 modes: lines separated by a newline character (012), lines glued seamless, lines separated by a single space or comma separated lines. 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.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated on October, 2 2006 using texi2html 1.76.

copyright  ©  November 23 2008 sean dreilinger url: http://durak.org/sean/pubs/software/screen/screen_61.html