Last active
August 29, 2015 14:13
-
-
Save jpanganiban/2157d3e16b42b1959560 to your computer and use it in GitHub Desktop.
Emacs Windmove Hooks
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
(defcustom windmove-pre-move-hook nil | |
"Hook run before windmove select is triggered." | |
:group 'windmove | |
:type 'hook) | |
(defcustom windmove-post-move-hook nil | |
"Hook run after windmove select is triggered." | |
:group 'windmove | |
:type 'hook) | |
; Override the window select function to add before and after hooks. | |
(defadvice windmove-do-window-select (around my-windmove-do-window-select act) | |
(run-hooks 'windmove-pre-move-hook) | |
ad-do-it | |
(run-hooks 'windmove-post-move-hook)) | |
(defun jp/window-move () | |
(golden-ratio)) | |
(add-hook 'windmove-post-move-hook 'jp/window-move) | |
(define-key global-map (kbd "C-k") 'evil-window-up) | |
(define-key global-map (kbd "C-j") 'evil-window-down) | |
(define-key global-map (kbd "C-h") 'evil-window-left) | |
(define-key global-map (kbd "C-l") 'evil-window-right) | |
; THAN THIS!!! | |
;;Override evil-window-moves with something that triggers the golden-ratio. | |
;(evil-define-command jp/window-left (count) | |
; (interactive "p") | |
; (evil-window-left count) | |
; (golden-ratio)) | |
;(evil-define-command jp/window-right (count) | |
; (interactive "p") | |
; (evil-window-right count) | |
; (golden-ratio)) | |
;(evil-define-command jp/window-up (count) | |
; (interactive "p") | |
; (evil-window-up count) | |
; (golden-ratio)) | |
;(evil-define-command jp/window-down (count) | |
; (interactive "p") | |
; (evil-window-down count) | |
; (golden-ratio)) | |
; | |
;(define-key global-map (kbd "C-h") 'jp/window-left) | |
;(define-key global-map (kbd "C-j") 'jp/window-down) | |
;(define-key global-map (kbd "C-k") 'jp/window-up) | |
;(define-key global-map (kbd "C-l") 'jp/window-right) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment