summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorbenj <benj@rse8.com>2018-04-12 16:00:57 -0700
committerbenj <benj@rse8.com>2018-04-12 16:00:57 -0700
commit50421acd2320fd14b7b9786c6e416aed5c1b07f3 (patch)
treef9c3ca5afff7d34daa166ac5945a62503487e61e /utils
parenta7f61d6bc345aef3333d19b52bf8a0fe57cfefd2 (diff)
downloademacs-50421acd2320fd14b7b9786c6e416aed5c1b07f3.tar
emacs-50421acd2320fd14b7b9786c6e416aed5c1b07f3.tar.gz
emacs-50421acd2320fd14b7b9786c6e416aed5c1b07f3.tar.bz2
emacs-50421acd2320fd14b7b9786c6e416aed5c1b07f3.tar.lz
emacs-50421acd2320fd14b7b9786c6e416aed5c1b07f3.tar.xz
emacs-50421acd2320fd14b7b9786c6e416aed5c1b07f3.tar.zst
emacs-50421acd2320fd14b7b9786c6e416aed5c1b07f3.zip
multiple cursors new bindings
Diffstat (limited to 'utils')
-rw-r--r--utils/bindKeys.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/utils/bindKeys.el b/utils/bindKeys.el
new file mode 100644
index 0000000..c07c393
--- /dev/null
+++ b/utils/bindKeys.el
@@ -0,0 +1,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