Slackware
Slackware

Reputation: 1000

How to rebind C-r (undo-tree-redo) in Emacs with evil-mode?

So I was wondering, how would I remap C-r when I am using evil-mode?

When I run C-h k C-r, I am told that C-r is bound in the undo-tree-map mapping.

So, I have tried to unbind it like so:

(define-key undo-tree-map (kbd "C-r") nil)

However, when I do C-h k C-r, I am yet again told that

C-r runs the command undo-tree-redo ...

So, how would I rebind it?

Upvotes: 2

Views: 3459

Answers (1)

Slackware
Slackware

Reputation: 1000

It seems like there is a bug in Emacs where it does not tell you which mapping is mapping C-r to undo-tree-redo.

It seems like it's a bug in how emacs reports which file/mode/map defines a binding, when many bindings bind to the same function.

Nevertheless, the issue is with evil-mode doing the binding.

To rebind C-r to something else, try instead:

(define-key evil-normal-state-map (kbd "C-r") 'evil-scroll-line-up)

Voila!

Upvotes: 4

Related Questions