Created
February 18, 2016 20:22
-
-
Save wasamasa/db0d1ef97814caffb4e0 to your computer and use it in GitHub Desktop.
my-define-keys
This file contains 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
(defun my-partition (n list) | |
(let (result) | |
(while list | |
(let ((i 0) | |
chunk) | |
(while (< i n) | |
(push (pop list) chunk) | |
(setq i (1+ i))) | |
(push (nreverse chunk) result))) | |
(nreverse result))) | |
(my-partition 3 '(1 2 3 4 5 6 7 8 9 10)) ;=> '((1 2 3) (4 5 6) (7 8 9) (10 nil nil)) | |
(defmacro my-define-keys (feature keymap &rest bindings) | |
`(with-eval-after-load ',feature | |
,@(mapcar | |
(lambda (binding) | |
`(define-key ,keymap (kbd ,(car binding)) ',(cadr binding))) | |
(my-partition 2 bindings)))) | |
(my-define-keys evil-maps evil-normal-state-map | |
"z r" my-revert-buffer | |
"z s" describe-char | |
"z e" toggle-debug-on-error | |
"z q" toggle-debug-on-quit | |
"z t" my-solarized-toggle | |
"z m" my-toggle-mode-line-minor-modes | |
"z n" my-narrow-to-region-with-mode | |
"z TAB" evil-toggle-fold | |
"z <backtab>" my-evil-toggle-folds) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment