https://github.com/guiltydolphin/emaps
Utilities for working with keymaps in Emacs
https://github.com/guiltydolphin/emaps
emacs emacs-lisp
Last synced: 11 months ago
JSON representation
Utilities for working with keymaps in Emacs
- Host: GitHub
- URL: https://github.com/guiltydolphin/emaps
- Owner: GuiltyDolphin
- License: gpl-3.0
- Created: 2016-06-20T17:58:52.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-05-08T18:01:03.000Z (about 6 years ago)
- Last Synced: 2025-04-10T03:46:47.765Z (about 1 year ago)
- Topics: emacs, emacs-lisp
- Language: Emacs Lisp
- Size: 60.5 KB
- Stars: 13
- Watchers: 1
- Forks: 3
- Open Issues: 7
-
Metadata Files:
- Readme: README.org
- Changelog: CHANGELOG.org
- License: LICENSE
Awesome Lists containing this project
README
#+TITLE: Emaps
* Introduction
Emaps provides utilities for working with keymaps and keybindings in Emacs.
* Features
** Defining keys
Emacs has a built-in ~define-key~ function, but this can only handle one binding
at a time, for example:
#+BEGIN_SRC emacs-lisp
(define-key keymap "a" 'fun-a)
(define-key keymap "b" 'fun-b)
(define-key keymap "c" 'fun-c)
; etc.
#+END_SRC
Emaps provides the ~emaps-define-key~ function that provides the same
functionality, but allows multiple keys to be defined at once, thus the
above becomes:
#+BEGIN_SRC emacs-lisp
(emaps-define-key keymap
"a" 'fun-a
"b" 'fun-b
"c" 'fun-c) ; etc.
#+END_SRC
** Viewing keymaps
Run ~M-x emaps-describe-keymap-bindings~ to display the
bindings for a given keymap (see below),
~emaps-describe-keymap~ can be used to view keymaps as
variables (but with characters displayed instead of integers,
where possible). Executing these commands with a prefix
argument allows you to choose from only active keymaps.
#+CAPTION: Display after running ~emaps-describe-keymap-bindings~ with ~magit-status-mode-map~.
#+NAME: fig:emaps-describe-keymap-bindings-magit-status-mode-map
[[./images/emaps-describe-keymap-bindings.png]]
** Recommended Bindings
I recommend the following bindings with Emaps (though I
encourage you to experiment and find what works best for you):
| Key | Command |
|---------+----------------------------------|
| ~C-h K~ | ~emaps-describe-keymap-bindings~ |
Which you can set with the following snippet:
#+BEGIN_SRC emacs-lisp
(emaps-define-key global-map
(kbd "C-h K") 'emaps-describe-keymap-bindings)
#+END_SRC