Next: , Previous: , Up: Windows   [Contents][Index]

20.5 Deleting and Resizing Windows

C-x 0

Delete the selected window (delete-window).

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).

To delete the selected window, type C-x 0 (delete-window). (That is a zero.) Once a window is deleted, the space that it occupied is given to an adjacent window (but not the minibuffer window, even if that is active at the time). Deleting the window has no effect on the buffer it used to display; the buffer continues to exist, and you can still switch to it 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) deletes all the windows, except the selected one; the selected window expands to use the whole frame. (This command cannot be used while the minibuffer window is active; attempting to do so signals an error.)

The command C-x ^ (enlarge-window) makes the selected window one line taller, taking space from a vertically adjacent window without changing the height of the frame. With a positive numeric argument, this command increases the window height by that many lines; with a negative argument, it reduces the height by that many lines. If there are no vertically adjacent windows (i.e., the window is at the full frame height), that signals an error. The command also signals an error if you attempt to reduce the height of any window below a certain minimum number of lines, specified by the variable window-min-height (the default is 4).

Similarly, C-x } (enlarge-window-horizontally) makes the selected window wider, and C-x { (shrink-window-horizontally) makes it narrower. These commands signal an error if you attempt to reduce the width of any window below a certain minimum number of columns, specified by the variable window-min-width (the default is 10).

Mouse clicks on the mode line (see Mode Line Mouse) or on window dividers (see Window Dividers) provide another way to change window heights and to split or delete windows.

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.

Next: , Previous: , Up: Windows   [Contents][Index]