blob: c07c39303f5ef2ca3204e9e12df90d223d8b2a1c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
;;; bindKeys.el --- bind key sequence to a key map -*- lexical-binding: t; -*-
;; Author: Benj Bellon
;; Keywords: lisp
;;; Commentary:
;; Bind key seqeuence to a keymap
;;; Code:
(require 'dash)
(defun bindKeys (triggerSeq bindings)
"Bind keys to a trigger sequence.
TRIGGERSEQ is a sequence of key(s) to trigger the binding.
BINDINGS is an alist of bindings."
(let ((trigger (concat (-reduce (lambda (acc cur) (concat acc cur)) triggerSeq) " ")))
(mapcar (lambda (binding)
(global-set-key
(kbd (concat (concat "C-c " trigger) (car binding)))
(cdr binding)))
bindings)))
(provide 'bindKeys)
;;; bindKeys.el ends here
|