使用鼠标,您可以拖动窗口大小。
单击模式线上非“活动”的任意位置(缓冲区名称是安全的,或右侧任何未使用的区域),然后可以向上或向下拖动。
左右拖动需要非常精确地单击两条模式线的连接点。
C-x - (shrink-window-if-larger-than-buffer
) will shrink a window to fit its content.
C-x + (balance-windows
) will make windows the same heights and widths.
C-x ^ (enlarge-window
) increases the height by 1 line, or the prefix arg value. A negative arg shrinks the window. e.g. C-- C-1 C-6 C-x ^ shrinks by 16 rows, as does C-u - 1 6 C-x ^.
(没有默认绑定shrink-window
.)
C-x } (enlarge-window-horizontally
) does likewise, horizontally.
C-x { (shrink-window-horizontally
) is also bound by default.
Following one of these commands with repeat
(C-x z to initiate, and just z for continued repetition) makes it pretty easy to get to the exact size you want.
如果您经常想要使用特定值执行此操作,您可以录制键盘宏来执行此操作,或者使用类似
(global-set-key (kbd "C-c v") (kbd "C-u - 1 6 C-x ^"))
Or this:
(global-set-key (kbd "C-c v") (kbd "C-x o C-x 2 C-x 0 C-u - 1 C-x o"))
这是一个有点 hacky,所以这会更好:
(defun halve-other-window-height ()
"Expand current window to use half of the other window's lines."
(interactive)
(enlarge-window (/ (window-height (next-window)) 2)))
(global-set-key (kbd "C-c v") 'halve-other-window-height)
Tangentially, I also love winner-mode
which lets you repeatedly 'undo' any changes to window configurations with C-c left (whether the change is the size/number/arrangement of the windows, or just which buffer is displayed). C-c right returns you to the most recent configuration. Set it globally with (winner-mode 1)