Operators
An operator is a command that acts on the text moved over by a motion, such as c (change), d (delete) or y (yank or copy, not to be confused with “yank” in Emacs terminology which means `paste').
Emacs Lisp Autofunction: (evil-define-operator OPERATOR (BEG END ARGS...) DOC [[KEY VALUE]...] BODY...)
Define an operator command `OPERATOR'. The operator acts on the range of characters `BEG' through `END'. `BODY' must execute the operator by potentially manipulating the buffer contents, or otherwise causing side effects to happen.
Optional keyword arguments are:
:type- force the input range to be of a given type (inclusive,line,block, andexclusive, or a self-defined motion type).:motion- use a predetermined motion instead of waiting for one from the keyboard. This does not affect the behavior in visual state, where selection boundaries are always used.:repeat- if non-nil (default), then.will repeat the operator.:move-point- if non-nil (default), the cursor will be moved to the beginning of the range before the body executes:keep-visual- if non-nil, the selection is not disabled when the operator is executed in visual state. By default, visual state is exited automatically.
For example, this is an operator that performs ROT13 encryption on the text under consideration:
emacs-lisp
(evil-define-operator evil-rot13 (beg end)
"ROT13 encrypt text."
(rot13-region beg end))Binding this to g? (where it is by default) will cause a key sequence such as g?w to encrypt from the current cursor to the end of the word.