diff options
-rw-r--r-- | init/km-func.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/init/km-func.el b/init/km-func.el index 536abc3..90a4734 100644 --- a/init/km-func.el +++ b/init/km-func.el @@ -221,3 +221,17 @@ is non-nil, the region is copied with `x-select-text'." (interactive) (let ((fill-column (point-max))) (fill-paragraph nil))) + +;; http://www.emacswiki.org/emacs/ToggleWindowSplit +(defun km/toggle-frame-split () + "If the frame is split vertically, split it horizontally or vice versa. +Assumes that the frame is only split into two." + (interactive) + (unless (= (length (window-list)) 2) + (error "Can only toggle a frame split in two")) + (let ((split-vertically-p (window-combined-p))) + (delete-window) + (if split-vertically-p + (split-window-horizontally) + (split-window-vertically)) + (switch-to-buffer nil))) |