我看到邪惡變化或邪惡刪除等一些功能在邪惡視覺狀態下的視覺區域的開始和結束。 我已經看過這些函數的「evil-commands.el」中的源代碼,但它們的'beg'和'end'參數似乎無處不在。有些(如下面的)甚至沒有交互性。在邪惡視覺模式下自動輸入結束參數
爲什麼這是我在自己的方法中可以做同樣的事情?
以下只是我看着的方法之一的一個例子:
;; Defined in ~/.emacs.d/elpa/evil-20170712.2350/evil-commands.el
(evil-define-operator evil-invert-char (beg end type)
"Invert case of character."
:motion evil-forward-char
(if (eq type 'block)
(evil-apply-on-block #'evil-invert-case beg end nil)
(evil-invert-case beg end)
(when evil-this-motion
(goto-char end)
(when (and evil-cross-lines
evil-move-cursor-back
(not evil-move-beyond-eol)
(not (evil-visual-state-p))
(not (evil-operator-state-p))
(eolp) (not (eobp)) (not (bolp)))
(forward-char)))))