|
@@ -110,3 +110,31 @@
|
|
|
(global-set-key (kbd "C-d") 'duplicate-line)
|
|
(global-set-key (kbd "C-d") 'duplicate-line)
|
|
|
|
|
|
|
|
(put 'scroll-left 'disabled nil)
|
|
(put 'scroll-left 'disabled nil)
|
|
|
|
|
+
|
|
|
|
|
+(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))))))
|
|
|
|
|
+
|
|
|
|
|
+(global-set-key (kbd "C-x |") #'toggle-window-split)
|