如何将Emacs窗口从垂直拆分更改为水平拆分?


26
Window A
++++++++
Window B

有没有办法切换到

Window A : Window B

有没有一种方法可以在不关闭窗口的情况下切换视图?


1
在今天的大屏幕上,为什么有人要运行并排窗口之外的其他东西?我使用分布在两个监视器上的六个窗口- 启动Emacs时使用github.com/Lindydancer/multicolumn设置窗口,并配置了大多数软件包以重用现有窗口。
Lindydancer

3
可能会以最快的方式
TooTone

Answers:


13

这是一个简单的功能,可以在水平和垂直分割之间切换。假定您只有两个窗口,并且不进行任何调整大小:

(defun window-split-toggle ()
  "Toggle between horizontal and vertical split with two windows."
  (interactive)
  (if (> (length (window-list)) 2)
      (error "Can't toggle with more than 2 windows!")
    (let ((func (if (window-full-height-p)
                    #'split-window-vertically
                  #'split-window-horizontally)))
      (delete-other-windows)
      (funcall func)
      (save-selected-window
        (other-window 1)
        (switch-to-buffer (other-buffer))))))


9

MELPAtranspose-frame也提供该软件包。

使用M-x transpose-frame或将其绑定到某些东西来完成此操作。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.