If I have Emacs split horizontally and on top I'm editing elisp code and on the bottom I am in the shell. By default, Emacs makes the two windows equal in size, but I'd like the shell buffer smaller. I was wondering how I could do that.
shrink-window-if-larger-than-buffer) to shrink a window to fit its content.
balance-windows) to make windows the same heights and widths.
enlarge-window) to increase height by 1 line, or the prefix arg value. A negative arg shrinks the window. Example: C-u - 3 C-x ^
Also note that just like in a window system, you can use the mouse with xterm-mouse-mode to drag the window divider.
Note that this seems to sometimes depend a bit on the actual xterm or xterm-like program, and iirc in older Emacsen it wasn't reliable past about the 100th column unless you played with the TERM environment variable a bit, but in my Emacs 24.2.1 it works fine with emacs -nw -q (ie. totally ignoring my .emacs and manually enabling xterm-mouse-mode with
Update: FYI for completeness I'll point out this also works for vertical dividers (ie. when you have split with
I've ever written a simple minor-mode (for my personal usage) to interactively
resize-frame. I think this should be convenient.
M-x resize-frameto enable the
arrow keysto adjust size horizontally/vertically.
- Press any other keys to disable.