如何改变分屏emacs窗口大小? [英] How to change size of split screen emacs windows?

查看:1780
本文介绍了如何改变分屏emacs窗口大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有emacs水平分割 - 在顶部我正在编辑Perl代码,底部是shell。默认情况下,emacs使两个窗口大小相等,但是我希望shell缓冲区更小(也许是一半的大小?)。我想知道我该怎么做。

解决方案

使用鼠标,可以拖动窗口大小。

单击模式行上没有其他活动(缓冲区名称安全或右侧任何未使用区域)的任何位置,您可以向上或向下拖动。



侧向拖动需要在两个模式行加入的地方进行非常精确的点击。



Cx   - shrink-window-if-greater-than-buffer )将缩小窗口适合其内容。



Cx   + balance-windows )将使窗口的高度和宽度相同。



Cx   ^ enlarge-window )将高度增加1行或前缀arg值。负面的缩写缩小了窗口。例如Ç -   C-1   C-6   CX   ^ ; Cx   ^



(没有默认绑定 shrink-窗口。)



Cx   }

Cx   {(



按照以下命令之一,重复 Cx   z 启动,只是 z 继续重复)使得很容易达到确切的大小你想要的。



如果您经常想要使用特定的值,可以录制键盘宏来执行此操作,或使用类似于

(global-set-key(kbdCc v)(kbdCu - 1 6 Cx ^))



或者这个:

(global-set-key(kbdCc v)(kbdCx o Cx 2 Cx 0 Cu - 1 Cx o)) / code>



哪个是smidgen黑客,所以这会更好:

(interactive)
(enlarge-窗口(/(window-height(next-window))2)))

(global-set-key(kbdCc v)'halve-other-window-height)

相反,我也喜欢获胜者模式使用 Cc   left 重新撤消窗口配置的更改(无论更改是窗口的大小/数量/排列,还是只显示哪个缓冲区) 。 C-c   right 返回到最近的配置。在全球设置(胜者模式1)


I have emacs split horizontally - on top I'm editing Perl code, the bottom is the shell. By default emacs makes the two windows equal in size, but I'd like the shell buffer smaller (maybe half the size?). I was wondering how I could do that.

解决方案

With the mouse, you can drag the window sizes around.

Click anywhere on the mode line that is not otherwise 'active' (the buffer name is safe, or any unused area to the right hand side), and you can drag up or down.

Side-to-side dragging requires a very precise click on the spot where the two mode lines join.

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

(There is no default binding for 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.

If you regularly want to do this with a specific value, you could record a keyboard macro to do it, or use something like
(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"))

Which is a smidgen hacky, so this would be better:

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

这篇关于如何改变分屏emacs窗口大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆