From 50421acd2320fd14b7b9786c6e416aed5c1b07f3 Mon Sep 17 00:00:00 2001 From: benj Date: Thu, 12 Apr 2018 16:00:57 -0700 Subject: multiple cursors new bindings --- utils/bindKeys.el | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 utils/bindKeys.el (limited to 'utils/bindKeys.el') 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 -- cgit v1.2.3