GNU Emacs Manual - Two-Column

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

## Two-Column Editing

Two-column mode lets you conveniently edit two side-by-side columns of text. It uses two side-by-side windows, each showing its own buffer.

There are three ways to enter two-column mode:

``F2` 2` or `C-x 6 2`
  Enter two-column mode with the current buffer on the left, and on the right, a buffer whose name is based on the current buffer's name (`2C-two-columns`). If the right-hand buffer doesn't already exist, it starts out empty; the current buffer's contents are not changed. This command is appropriate when the current buffer is empty or contains just one column and you want to add another column.
``F2` s` or `C-x 6 s`
  Split the current buffer, which contains two-column text, into two buffers, and display them side by side (`2C-split`). The current buffer becomes the left-hand buffer, but the text in the right-hand column is moved into the right-hand buffer. The current column specifies the split point. Splitting starts with the current line and continues to the end of the buffer. This command is appropriate when you have a buffer that already contains two-column text, and you wish to separate the columns temporarily.
``F2` b buffer `RET``
`C-x 6 b buffer `RET``
  Enter two-column mode using the current buffer as the left-hand buffer, and using buffer buffer as the right-hand buffer (`2C-associate-buffer`).

``F2` s` or `C-x 6 s` looks for a column separator, which is a string that appears on each line between the two columns. You can specify the width of the separator with a numeric argument to ``F2` s`; that many characters, before point, constitute the separator string. By default, the width is 1, so the column separator is the character before point.

When a line has the separator at the proper place, ``F2` s` puts the text after the separator into the right-hand buffer, and deletes the separator. Lines that don't have the column separator at the proper place remain unsplit; they stay in the left-hand buffer, and the right-hand buffer gets an empty line to correspond. (This is the way to write a line that "spans both columns while in two-column mode": write it in the left-hand buffer, and put an empty line in the right-hand buffer.)

The command `C-x 6 `RET`` or ``F2` `RET`` (`2C-newline`) inserts a newline in each of the two buffers at corresponding positions. This is the easiest way to add a new line to the two-column text while editing it in split buffers.

When you have edited both buffers as you wish, merge them with ``F2` 1` or `C-x 6 1` (`2C-merge`). This copies the text from the right-hand buffer as a second column in the other buffer. To go back to two-column editing, use ``F2` s`.

Use ``F2` d` or `C-x 6 d` to dissociate the two buffers, leaving each as it stands (`2C-dissociate`). If the other buffer, the one not current when you type ``F2` d`, is empty, ``F2` d` kills it.

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