The Emacs screen area can be divided into multiple windows. Each
window contains one buffer, so the contents of a window can change
depending on the buffer it contains. The most common way to create new
windows is to split the screen into two regions with C-x 2
or C-x
3
. The first splits the screen in half horizontally, the second splits
it vertically. Any Emacs window can be split multiple times, so if you
have a large display, you could have lots of windows open. You can
cycle through visible windows with C-x o
(think of the "o" as meaning
"other window"). When you do have another window open, it's sometimes
useful to scroll the other window without leaving your current
one. You can do this with C-M-v
. This is particularly useful for when
Emacs pops up a completion or help buffer in a new window that you
would like to scroll through.
You can close a window with C-x 0
or C-x 1
. The first closes the
window you are currently in, the second closes all the other windows,
but leaves the window you are currently in open for you. Closing a
window does not destroy the buffer it contains, so you can think of a
window as a view into a buffer (in fact you can have multiple windows
visiting different parts of the same buffer). Here is a list of the
most useful window commands:
C-x 0 | Close this window |
C-x 1 | Close all other visible windows |
C-x 2 | Split horizontally |
C-x 3 | Split vertically |
C-x o | Switch to other window |
C-M-v | Scroll other window |