GNU Emacs Manual - Change Window

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

## Deleting and Rearranging Windows

`C-x 0`
  Delete the selected window (`delete-window`). The last character in this key sequence is a zero.
`C-x 1`
  Delete all windows in the selected frame except the selected window (`delete-other-windows`).
`C-x 4 0`
  Delete the selected window and kill the buffer that was showing in it (`kill-buffer-and-window`). The last character in this key sequence is a zero.
`C-x ^`
  Make selected window taller (`enlarge-window`).
`C-x }`
  Make selected window wider (`enlarge-window-horizontally`).
`C-x {`
  Make selected window narrower (`shrink-window-horizontally`).
`C-x -`
  Shrink this window if its buffer doesn't need so many lines (`shrink-window-if-larger-than-buffer`).
`C-x +`
  Make all windows the same height (`balance-windows`).
`Drag-Mouse-1`
  Dragging a window's mode line up or down with `Mouse-1` changes window heights.
`Mouse-2`
  `Mouse-2` in a window's mode line deletes all other windows in the frame (`mouse-delete-other-windows`).
`Mouse-3`
  `Mouse-3` in a window's mode line deletes that window (`mouse-delete-window`).

To delete a window, type `C-x 0` (`delete-window`). (That is a zero.) The space occupied by the deleted window is given to an adjacent window (but not the minibuffer window, even if that is active at the time). Once a window is deleted, its attributes are forgotten; only restoring a window configuration can bring it back. Deleting the window has no effect on the buffer it used to display; the buffer continues to exist, and you can select it in any window with `C-x b`.

`C-x 4 0` (`kill-buffer-and-window`) is a stronger command than `C-x 0`; it kills the current buffer and then deletes the selected window.

`C-x 1` (`delete-other-windows`) is more powerful in a different way; it deletes all the windows except the selected one (and the minibuffer); the selected window expands to use the whole frame except for the echo area.

You can also delete a window by clicking on its mode line with `Mouse-2`, and delete all the windows in a frame except one window by clicking on that window's mode line with `Mouse-3`.

The easiest way to adjust window heights is with a mouse. If you press `Mouse-1` on a mode line, you can drag that mode line up or down, changing the heights of the windows above and below it.

To readjust the division of space among vertically adjacent windows, use `C-x ^` (`enlarge-window`). It makes the currently selected window get one line bigger, or as many lines as is specified with a numeric argument. With a negative argument, it makes the selected window smaller. `C-x }` (`enlarge-window-horizontally`) makes the selected window wider by the specified number of columns. `C-x {` (`shrink-window-horizontally`) makes the selected window narrower by the specified number of columns.

When you make a window bigger, the space comes from one of its neighbors. If this makes any window too small, it is deleted and its space is given to an adjacent window. The minimum size is specified by the variables `window-min-height` and `window-min-width`.

The command `C-x -` (`shrink-window-if-larger-than-buffer`) reduces the height of the selected window, if it is taller than necessary to show the whole text of the buffer it is displaying. It gives the extra lines to other windows in the frame.

You can also use `C-x +` (`balance-windows`) to even out the heights of all the windows in the selected frame.

See section Editing in the Minibuffer, for information about the Resize-Minibuffer mode, which automatically changes the size of the minibuffer window to fit the text in the minibuffer.

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