In evil mode, the r command, evil-replace
, waits for a replacement character to be typed and replaces the current character with it. Sometimes I hit r by mistake and wish to cancel, so I hit C-g. Instead of cancelling the evil-replace
, however, it replaces the current character with the escape code ^G
which I then have to undo.
Is there a way to make C-g cancel the evil-replace
, like esc does?
Update: this is now built in to evil
. See https://github.com/emacs-evil/evil/pull/1111. The answers below now only apply to legacy evil
versions.