Paredit emulation in lispy
02 Apr 2015Intro
I just finished this feature today. Almost all Paredit functionality is available in terms of
lispy's own functions. The only functions that I didn't
implement were the ones that I didn't find any use for: paredit-backslash
(ugh, prompts),
paredit-comment-dwim
(covered by regular ;), paredit-forward-down
and
paredit-backward-down
(both just move out of special, and throw a lot).
Setting the keymap theme
So if you ever thought that lispy
could be a good idea, but the non-special key bindings are weird,
and you're too used to Paredit, you can now try this setting:
(lispy-set-key-theme '(special paredit c-digits))
Here's the setting that I'm using, since I love lispy
's default bindings:
(lispy-set-key-theme '(oleh special lispy c-digits))
The default setting actually is this one, lispy-mode-map-oleh
is an additional map for use with
my Xmodmap setup:
(lispy-set-key-theme '(special lispy c-digits))
Each item in the list passed to lispy-set-key-theme
designates a keymap to turn on.
So in a non-LISP buffer you could turn on just the special map:
(lispy-set-key-theme '(special))
This would mean that zero regular bindings get overridden, but when the point is before or after a
paren, you get the lispy
bindings. Actually, I've just enabled lispy-mode
for markdown-mode
,
and it's working great. Unfortunately, I haven't yet figured out how to make a minor mode's keymap
buffer-local. Maybe someone reading has an idea.
The screencast
I went through all of Paredit tests and made ERT tests out of them, to make sure that the features are actually working. I've recorded a short (<3 minutes) screencast of implementing one of the tests. Have a look, maybe you'll something interesting in my setup. There are two short pauses in the video, that's just me thinking how to write down a function. My ERT and Magit workflows are also shown.
Outro
The new key-theme feature is meant to make lispy
super-not-annoying. I think it's useful, since
using lispy
in Paredit mode was annoying for me, so the opposite has to be true for people that
are used to Paredit. So if you notice a bug, please report it, bug
reports are very important for my non-annoyance agenda.
Finally, if you're super-devoted to Paredit and don't want to drop it, now you can easily have both
lispy-mode
and paredit-mode
on. Just use this setting:
(lispy-set-key-theme '(special))
Or this one if you additionally want C-1 to show the inline doc, and C-2 to show the inline args:
(lispy-set-key-theme '(special c-digits))