0

In lispy-mode, I want to use control + the arrow keys instead of lispy's defaults (h, j, k, l).

But if I run the obvious code

     (define-key lispy-mode-map [C-up] 'lispy-up)

then C-up always calls lispy-up. This is unlike lispy's defaults, which are only available when one is right next to a parenthesis.

How do I make control + the arrows to operate exactly as h, j, k, l?

  • Maybe look at the lispy.el code, to see what kind of bindings it makes, and do the same? Are those keys bound in a mode map, perhaps? – Drew Aug 1 at 23:58
  • Try C-h k h when in lispy mode to see what function is bound to key h. – JeanPierre Aug 2 at 11:44
  • @JeanPierre: interestingly, h does not call lispy-left but special-lispy-left, which calls lispy-left (when in the right position) or self inserts, otherwise. The problem is that C-up does not do anything when self inserted. I'm guessing the solution will be to write my own special-lispy-left, which will call lispy-left or left-word. – scaramouche Aug 2 at 14:03
  • Indeed. I hope at some point emacs will provide some more convenient way to do that (sort of a keymap that binds a (key, context) to a command) since such "context based" bindings are becoming very common (org-mode uses that a lot). – JeanPierre Aug 5 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.