Created
April 20, 2010 12:37
-
-
Save lukaszkorecki/372373 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; emacsd-tile.el -- tiling windows for emacs | |
| ;; Modified to use arrow keys | |
| (defun swap-with (dir) | |
| (interactive) | |
| (let ((other-window (windmove-find-other-window dir))) | |
| (when other-window | |
| (let* ((this-window (selected-window)) | |
| (this-buffer (window-buffer this-window)) | |
| (other-buffer (window-buffer other-window)) | |
| (this-start (window-start this-window)) | |
| (other-start (window-start other-window))) | |
| (set-window-buffer this-window other-buffer) | |
| (set-window-buffer other-window this-buffer) | |
| (set-window-start this-window other-start) | |
| (set-window-start other-window this-start))))) | |
| (global-set-key (kbd "C-M-<down>") (lambda () (interactive) (swap-with 'down))) | |
| (global-set-key (kbd "C-M-<up>") (lambda () (interactive) (swap-with | |
| 'up))) | |
| (global-set-key (kbd "C-M-<left>") (lambda () (interactive) (swap-with 'left))) | |
| (global-set-key (kbd "C-M-<right>") (lambda () (interactive) (swap-with 'right))) | |
| (global-set-key (kbd "M-S-<down>") (lambda () (interactive) (enlarge-window 1))) | |
| (global-set-key (kbd "M-S-<up>") (lambda () (interactive) (enlarge-window -1))) | |
| (global-set-key (kbd "M-S-<left>") (lambda () (interactive) (enlarge-window -1 t))) | |
| (global-set-key (kbd "M-S-<right>") (lambda () (interactive) (enlarge-window 1 t))) | |
| (global-set-key (kbd "M-<down>") 'windmove-down) | |
| (global-set-key (kbd "M-<up>") 'windmove-up) | |
| (global-set-key (kbd "M-<left>") 'windmove-left) | |
| (global-set-key (kbd "M-<right>") 'windmove-right) | |
| (provide 'emacsd-tile) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment