reddit / emacs

How to create custom operator-pending mappings for evil

_Infi_ · 2022-10-21 18:08
Recent emacs converter coming from nvim. One type of operation I'm finding hard time to replicate is the custom operator-pending mappings. In lisp like files, I use operators from [vim-sexp](https://github.com/guns/vim-sexp) a lot. e.g. similarly to `caw` (change a word), the plugin adds `daf` (delete a form), `cae` (change an element), etc. How can I replicate them? I'm having a hard time to find related docs, it seems that "operator" has other meanings in emacs.
yyoncho · 2022-10-21 18:19
I use evil-cleverparens for that
JustinSilverman · 2022-10-21 18:42
Am I misunderstanding or are you actually asking about making more text objects? Lispyville is good.
_Infi_ · 2022-10-21 19:10
I'll check that out. Thanks!
_Infi_ · 2022-10-21 19:13
Ah that's what it means then. I've been intentionally ignoring those parts of docs \*facepalm\*. If anyone is interested, this is how evil implements it: [https://github.com/emacs-evil/evil/blob/a13a05f263dd54632d4509e7cfb2bb5df556d442/evil-maps.el#L344](https://github.com/emacs-evil/evil/blob/a13a05f263dd54632d4509e7cfb2bb5df556d442/evil-maps.el#L344) Thanks! :)
FreeAd7233 · 2022-10-21 20:21
do you mean text objects or operator? Text objects means a range of a text that can be operated. For example, caw, where c is the operator, and aw is the text object.
_Infi_ · 2022-10-23 02:08
Yes, text objects! reusing vim's vocabulary isn't helping. Thanks for help!