siteshen
2014-08-13 13:48:20 +08:00
;; 分2-4屏(没用过更大的显示器了),绑定M-0到'other-window
(defun smart-split ()
(interactive)
(delete-other-windows)
(split-window-horizontally) ;; 最少分两屏
(other-window 1)
(switch-to-next-buffer)
(other-window 1)
(unless (< (window-width) 120) ;; 240+ 三屏
(split-window-horizontally)
(balance-windows)
(switch-to-next-buffer)
(other-window 1))
(unless (< (window-width) 100) ;; 300+ 四屏
(split-window-horizontally)
(balance-windows)
(switch-to-next-buffer)
(other-window 1))
(recenter))
(progn
(keydef "M-0" other-window)
(keydef "M-4" kill-this-buffer)
(keydef "M-1" delete-other-windows)
(keydef "M-2" smart-split)
(keydef "M-3" split-window-horizontally))