0

Is there a way to programatically get the available movement commands for evil emacs?

Preferably also with the key they are currently bound to.

(There are a lot of commands for movement, but I do not know whether they are grouped or categorized in a way that makes them accessible as movement commands.)

2
  • 1
    What exactly is this for, an Evil cheatsheet?
    – wasamasa
    Commented Oct 25, 2015 at 11:10
  • Something similar, yes. Commented Oct 25, 2015 at 12:01

1 Answer 1

1

If this question weren't about programmatic access (for designing something like a printable cheatsheet), I'd suggest you to look at either evil-maps.el or evil-motions in evil-vars.el.

Evil's motions are bound in evil-motion-state-map, so a possible approach would be just traversing that keymap and tracking both the key and command while doing so. The problem with that is that (surprise, surprise), it's not just motions there, for example digit-argument is bound there to the number keys.

An alternative approach would be traversing evil-command-properties (which is a variable altered by every Evil command defined) and looking for items with :repeat motion as their property, these should be motions. You could then look up what key these are bound to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.