0

So, in evil mode, something like d i b (delete inside brackets) is a common occurence. However, describe-key will immediately describe just the d part. Using (describe-key "d i b") produces: d i b is undefined.

How would I view a description of such a keybinding? And how are they called anyway, modal, sequential?

1

This is impossible with Evil's current design. Here's roughly what happens for a normal Emacs command:

  • Emacs waits for a complete keybinding
  • You press a key
  • Emacs looks it up in the currently active keymaps
  • It finds a match for a prefix
  • It waits for another key in that prefix map
  • It looks it up again
  • This repeats until a full keybinding has been read
  • Emacs executes the command

With Evil operators things are a bit different:

  • Emacs waits for a complete keybinding
  • You press a key
  • Emacs looks it up in the currently active keymaps
  • It finds a match in Evil's normal state map and executes the operator command
  • The operator command reads in more keys until it has figured out the range
  • You press i which is looked up and found as Evil's inner text objects map
  • You press b which is looked up and found in Evil's inner text objects map
  • The operator command computes the range and does its job

This explains why describe-key is insufficient here, it's done by the point the operator command is executed. If you wanted to do better, you'd need to write a custom command that knows that reading keys is not done after that and use it instead.

Your Answer

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

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