有没有办法在Emacs中使用retile缓冲窗口?

时间:2011-12-27 19:35:53

标签: emacs

我在emacs中打开了两个缓冲窗口,垂直排列。是否有一个水平重新排列它们的命令?

3 个答案:

答案 0 :(得分:6)

Transpose Frame库提供了一套出色的功能来操作框架中的窗口(transpose-framerotate-frame-clockwiserotate-frame-anti-clockwise中的任何一个都足以满足您的特定示例)。

还有其他选择,但我发现这个库相当全面。有关每个函数的功能,请参阅Wiki页面(或代码中的注释)。

答案 1 :(得分:4)

我使用following snippet taken from Emacs wiki

(defun toggle-window-split ()
  (interactive)
  (if (= (count-windows) 2)
      (let* ((this-win-buffer (window-buffer))
         (next-win-buffer (window-buffer (next-window)))
         (this-win-edges (window-edges (selected-window)))
         (next-win-edges (window-edges (next-window)))
         (this-win-2nd (not (and (<= (car this-win-edges)
                     (car next-win-edges))
                     (<= (cadr this-win-edges)
                     (cadr next-win-edges)))))
         (splitter
          (if (= (car this-win-edges)
             (car (window-edges (next-window))))
          'split-window-horizontally
        'split-window-vertically)))
    (delete-other-windows)
    (let ((first-win (selected-window)))
      (funcall splitter)
      (if this-win-2nd (other-window 1))
      (set-window-buffer (selected-window) this-win-buffer)
      (set-window-buffer (next-window) next-win-buffer)
      (select-window first-win)
      (if this-win-2nd (other-window 1))))))

(define-key ctl-x-4-map "t" 'toggle-window-split)

只需将其放入init.el并使用 Ctrl - x 4 t

答案 2 :(得分:3)

你问过一个框架中的平铺窗口。其他人会直接回答你( C-x 3 是一个开始)。但您可能还想知道,您可以在显示屏的上方或下方使用单独的框架和tile the frames