summaryrefslogtreecommitdiff
path: root/init/km-func.el
diff options
context:
space:
mode:
authorKyle Meyer <meyerkya@gmail.com>2013-07-24 12:31:05 -0400
committerKyle Meyer <meyerkya@gmail.com>2013-07-24 12:31:05 -0400
commitec6d4784e7c4e4ade14cefb1da561c32300949fa (patch)
treef383df1cdfc1a85e4ab19e5da72763187a4f19cb /init/km-func.el
parent4f51322552da0f1c4bb9b0ae58daef643f2a331d (diff)
downloademacs.d-ec6d4784e7c4e4ade14cefb1da561c32300949fa.tar.gz
Add swap-windows from prelude
I tend handle more complicated window configurations with a tiling window manager, so I don't think I'd have much use for anything more complex (like transpose-frame.el).
Diffstat (limited to 'init/km-func.el')
-rw-r--r--init/km-func.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/init/km-func.el b/init/km-func.el
index e588a86..7d493b8 100644
--- a/init/km-func.el
+++ b/init/km-func.el
@@ -130,3 +130,23 @@ KILLARG."
(ad-activate 'recompile)
(global-set-key (kbd "C-c g") 'recompile)
+
+;; from prelude
+(defun km/swap-windows ()
+ "If you have 2 windows, it swaps them."
+ (interactive)
+ (if (/= (count-windows) 2)
+ (message "You need exactly 2 windows to do this.")
+ (let* ((w1 (car (window-list)))
+ (w2 (cadr (window-list)))
+ (b1 (window-buffer w1))
+ (b2 (window-buffer w2))
+ (s1 (window-start w1))
+ (s2 (window-start w2)))
+ (set-window-buffer w1 b2)
+ (set-window-buffer w2 b1)
+ (set-window-start w1 s2)
+ (set-window-start w2 s1)))
+ (other-window 1))
+
+(global-set-key (kbd "C-c s") 'km/swap-windows)