Overdr0ne / skey

sleek keys

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

skey: simple keybinding

Introduction

A very simple keybinding library. As of this writing, it’s just one function.

Installation

I just use straight+use-package like so:

(use-package skey
  :straight (gumshoe :type git
                     :host github
                     :repo "Overdr0ne/skey"
                     :branch "main"))

Usage

Keybinding works largely the same as define-key

(skey-define-keys
  '(c-mode-map)
  ; note the backtick so we can use the comma to evaluate perspective-map
  `(
    ("C-M-a" c-beginning-of-defun)
    ([remap end-of-defun] c-end-of-defun)
    ("M-p" ,project-prefix-map)))

I like to define sets of keymaps

(setq +repl-maps '(term-mode-map shell-mode-map term-raw-map geiser-repl-mode-map))
(skey-define-keys
  (cl-set-difference +repl-maps '(term-mode-map))
  `(("M-p" ,project-prefix-map)))

Notice, you can’t really achieve the above with keymap inheritance.

Similar Packages

  • https://github.com/noctuid/general.el General does much the same thing as this package, and much more, providing many facilities for evil users– all at the cost of a lot of added complexity. Further, because of the syntax of it’s key definers, you can’t nest functions to generate lists of keybindings.
  • use-package’s `:bind`: I suspect this is what most people use. Works well enough if you only rebind on init, and don’t mind lots of duplicate code for all the bindings common between multiple keymaps.

About

sleek keys

License:GNU General Public License v3.0


Languages

Language:Emacs Lisp 100.0%