: Learning GNU Emacs, 3rd Edition

4.6.3 Enlarging and Shrinking Windows

4.6.3 Enlarging and Shrinking Windows

Emacs always splits windows into two equal parts. Such a split is often good enough, but sometimes it's not, particularly if you become a window aficionado. When you have four or five or six windows on your screen at once, controlling each window's size becomes important. Otherwise, the windows you are most interested in will eventually become too small, and useful editing is almost impossible when you can see only five or six lines from a file. If you want to make the window you're working on taller, type C-x ^. Emacs lengthens the current window and makes the one below it smaller, accordingly. To make the current window wider, type C-x }. Emacs makes this window wider, at the expense of the one to the right of it.

To make windows smaller, you can shrink them. To shrink a window vertically, type M-x shrink-window. Emacs shrinks the current window by one line and the other windows on the screen grow accordingly. To shrink a window horizontally, type C-x {. This command makes the window one column narrower and enlarges the other windows on the screen horizontally.

Usually you want to work in larger increments than one line or one column at a time, however. When you type C-u preceding any of these commands, the command works in increments of four lines or columns at a time. For example, with two horizontal windows on the screen, let's use C-u C-x ^ to enlarge the james window.

Type: C-u C-x ^


Emacs makes the current window larger.

As you would expect, when you make the window larger, it automatically fills with more text from the buffer. There are shortcuts to sizing windows as well. If you have a very small bufferfor example, a one-line buffer containing the vocabulary-building word for the day and its definitionyou can shrink the window to the size of the buffer by typing C-x - (for shrink-window-if-larger-than-buffer). If the buffer is larger than the window, this command does nothing. Typing C-x + (for balance-windows) creates windows of equal size again. (This latter command is also useful if you have an odd number of windows; C-x + divides the display equally among them.)


: 0.260. /Cache: 3 / 1