GNU Emacs Manual - Split Window

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

## Splitting Windows

`C-x 2`
  Split the selected window into two windows, one above the other (`split-window-vertically`).
`C-x 3`
  Split the selected window into two windows positioned side by side (`split-window-horizontally`).
`C-Mouse-2`
  In the mode line or scroll bar of a window, split that window.

The command `C-x 2` (`split-window-vertically`) breaks the selected window into two windows, one above the other. Both windows start out displaying the same buffer, with the same value of point. By default the two windows each get half the height of the window that was split; a numeric argument specifies how many lines to give to the top window.

`C-x 3` (`split-window-horizontally`) breaks the selected window into two side-by-side windows. A numeric argument specifies how many columns to give the one on the left. A line of vertical bars separates the two windows. Windows that are not the full width of the screen have mode lines, but they are truncated. On terminals where Emacs does not support highlighting, truncated mode lines sometimes do not appear in inverse video.

You can split a window horizontally or vertically by clicking `C-Mouse-2` in the mode line or the scroll bar. The line of splitting goes through the place where you click: if you click on the mode line, the new scroll bar goes above the spot; if you click in the scroll bar, the mode line of the split window is side by side with your click.

When a window is less than the full width, text lines too long to fit are frequent. Continuing all those lines might be confusing. The variable `truncate-partial-width-windows` can be set non-`nil` to force truncation in all windows less than the full width of the screen, independent of the buffer being displayed and its value for `truncate-lines`. See section Continuation Lines.

Horizontal scrolling is often used in side-by-side windows. See section Controlling the Display.

If `split-window-keep-point` is non-`nil`, the default, both of the windows resulting from `C-x 2` inherit the value of point from the window that was split. This means that scrolling is inevitable. If this variable is `nil`, then `C-x 2` tries to avoid shifting any text the screen, by putting point in each window at a position already visible in the window. It also selects whichever window contain the screen line that the cursor was previously on. Some users prefer the latter mode on slow terminals.

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