3

For example, in in lisp-mode, I want to be able to use d as normal but also remap something like "dh" to something like "sp-splice-sexp-killing-backward". In vim you can remap keys like this without a problem, but with evil this would get rid of d's functionality altogether. Would there be some way to wrap this so that if a mapping exists for a d sequence, that action is taken and otherwise "evil-delete" is called with the key(s) instead?

2

As you've recognized correctly, evil isn't designed to support arbitrary mappings. The crux lies within the way Emacs keymaps work; to put it simply, if you press a key, it either resolves to a command or a prefix/keymap and waits for the next one. You cannot have both. evil chose to go for the first option and reads in a key by itself to determine the operand.

What is possible though is replacing the command with a custom that dispatches to either executing your custom command or the regular evil operator. Possible ways of doing so are elaborated upon in http://permalink.gmane.org/gmane.emacs.vim-emulation/2000.

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.