Skip to content

Instantly share code, notes, and snippets.

@yuutayamada
Created January 7, 2014 19:09
Show Gist options
  • Save yuutayamada/8304923 to your computer and use it in GitHub Desktop.
Save yuutayamada/8304923 to your computer and use it in GitHub Desktop.
Use this snippet if you encountered some trouble when you are using mykie.el with multiple-cursor.el
(eval-when-compile (require 'cl))
(defun* my/set-keybinds (map &rest key-and-func)
(loop with use-keymap = (keymapp map)
for i from 0 to (1- (length key-and-func)) by 2
for key = (nth i key-and-func)
for formatted-key = (if (vectorp key) key (kbd key))
for func = (nth (1+ i) key-and-func)
if use-keymap
do (define-key map formatted-key func)
else do (global-set-key formatted-key
(or func '(lambda () (interactive) nil)))))
(my/set-keybinds mc/keymap
"C-d" 'delete-char
"C-h" 'delete-backward-char
"C-n" 'next-line
"C-t" 'transpose-chars
"C-p" 'previous-line
"C-f" 'forward-char
"C-b" 'backward-char)
(loop for i from ?a to ?z
do (define-key mc/keymap (char-to-string i) 'self-insert-command))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment