https://github.com/HKey/keyset.git
git clone 'git://github.com/HKey/keyset.git'
A small library for structuring key bindings.
This library provides: - abstraction of key sequence - changing key sequence by the layout
Add following code to your init.el
.
(require 'keyset)
First, you define abstract key sequences, and then use them by define-key
.
```emacs-lisp
(keyset-defkey :next “n”)
(keyset-defkey :next-line '(:C :next))
;; This is equivalent to (define-key any-map (kbd “C-n”) 'next-line) (define-key any-map (keyset-key :next-line) 'next-line) ```
In keyset, you can define different key sequence for each layout.
For example, if you want to define key sequence for default layout
and dvorak layout, you will use &rest parameter of keyset-defkey
,
and change keyset-layout
to the layout that you want to use.
```emacs-lisp
(keyset-defkey :vim-next-line “j” :dvorak “h”)
(setq keyset-layout :dvorak)
;; This is equivalent to (define-key any-map (kbd “h”) 'next-line) (define-key any-map (keyset-key :vim-next-line) 'next-line) ```
| keyset-key
| kbd
|
|:———————-|:—————-|
| (keyset-key "abc")
| (kbd "abc")
|
| (keyset-key :C "a")
| (kbd "C-a")
|
| (keyset-key 'f11)
| (kbd "<f11>")
|