This package provides a minor mode that sets up
mnemonic key bindings for
Lispy. lispy-mnemonic
also makes
extensive use of hydras for
grouping related commands and improving discoverability.
lispy-mnemonic
started out as an attempt to make it easier for
myself to learn Lispy. I'm familiar with the concept of modal editing,
but I'm not a Vim user (which means that it doesn't come naturally to
me to use, e.g., hjkl for movement). Also, I find it harder
to commit a key sequence to memory if it is completely unrelated to
the command it is bound to (as evidenced by the fact that I rely
heavily on mnemonics in my
personal Emacs configuration).
There are probably some exceptions but in general, key binding choices are based on the following principles:
-
Make key bindings match command names. Alternatively, base key binding choices on default bindings for related functionality that ships with Emacs.
-
Group related commands under a common prefix. Separate commands that share a common prefix in Lispy if they don't seem to be strongly related in terms of functionality.
-
Improve discoverability, but don't be overly obtrusive.
-
Do not override default key bindings (especially if the functionality they provide is completely unrelated to the command you are trying to bind).
If you:
- would like to start learning Lispy
- have played around with Lispy but not mastered it
- haven't burned Vim-style key bindings into your muscle memory
- find that mnemonics make it easier to learn and remember new commands and key bindings
... there is a good chance you'll benefit from using lispy-mnemonic
.
If you have already memorized most or all of Lispy's commands and key
bindings (kudos!), you probably don't need this package. But before
you leave, do have a look at the
hydras
that lispy-mnemonic
ships with. Who knows, maybe you'll find a
couple that you like :)
lispy-mnemonic
is not on MELPA (yet). To start using
it, follow these steps:
-
If you haven't already, install
lispy
:M-x
package-install
RETlispy
RET -
Clone this repo:
git clone https://github.com/itsjeyd/lispy-mnemonic.git
-
Add the following to your init-file:
(add-to-list 'load-path "~/path/to/lispy-mnemonic/") (require 'lispy-mnemonic)
-
Optional: To turn
lispy-mnemonic-mode
on automatically for, e.g., buffers that are inemacs-lisp-mode
, add the following code to your init-file:(add-hook 'emacs-lisp-mode-hook 'lispy-mnemonic-mode)
Do M-x lispy-mnemonic-mode
RET to turn
lispy-mnemonic-mode
on or off.
See here for a full list of bindings.
By default, lispy-mnemonic
does not alter Lispy bindings that
conflict with default bindings for built-in commands. If you would
like to restore the original behavior of any bindings that Lispy
overrides, add the following to your init-file:
(setq lispy-mnemonic-restore-bindings t)
Here is a list of bindings that will be restored:
Keys | Command |
---|---|
C-2 | digit-argument |
C-3 | digit-argument |
C-4 | digit-argument |
C-7 | digit-argument |
C-8 | digit-argument |
C-9 | digit-argument |
M-, | tags-loop-continue |
M-m | back-to-indentation |
M-i | tab-to-tab-stop |
M-j | indent-new-comment-line |
M-J | indent-new-comment-line |