分类: LINUX
2010-04-21 13:16:52
Someone give me this function. 改变两个窗口的水平垂直平铺格局 (defun swap-window-split ()
"If the current frame has just two windows, then replace a vertical split
with a horizontal split, or vice-versa. Otherwise do nothing."
(interactive)
(let ((root-window (car (window-tree))))
(if (windowp root-window)
(message "There's just one big window")
(let ((w1 (elt root-window 2))
(w2 (elt root-window 3)))
(if (or (not (windowp w1))
(not (windowp w2)))
(message "Not a simple split")
(let ((b1 (window-buffer w1))
(b2 (window-buffer w2)))
(delete-other-windows w1)
(if (car root-window)
(split-window-horizontally)
(split-window-vertically))
(other-window 1)
(set-window-buffer (selected-window) b2)))))))
(global-set-key (kbd " |
dealover2010-04-21 14:57:36
This snippet can switch window layout between vertically and horizontally. (defun qw-swap-two-window-split () "Swap two windows in one frame, from vertical to horizontal or vice versa" (interactive) (if (= (count-windows) 2) (let ((root-window (car (window-tree)))) (let ((w1 (elt root-window 2)) (w2 (elt root-window 3))) (let* ((first-buf (window-buffer w1)) (second-buf (window-buffer w2))) (delete-other-windows w1) (if (car root-window) (split