How to remap Emacs evil-mode toggle key from Ctrl-Z?

6,215

Solution 1

No need to modify the source. Just customize "evil-toggle-key".

M-x customize-variable evil-toggle-key

You can also just set the variable using setq. Make sure you set that variable before emacs loads evil, since evil uses the variable's value when setting the keymaps up. For example, this is how it goes in my .emacs:

(setq evil-toggle-key "C-`")
(require 'evil)

:)

Solution 2

I can modify the source by changing this line, to use ctrl backtick:

evil-vars.el

(defcustom evil-toggle-key "C-`"

I'd rather have a way that doesn't modify the source to make it easier to upgrade later, but this should work. This hack definitely works.

Share:
6,215

Related videos on Youtube

justingordon
Author by

justingordon

Updated on September 18, 2022

Comments

  • justingordon
    justingordon over 1 year

    I'd like to remap the toggle key for emacs evil mode. From Ctrl+Z to something that won't confuse me like the CUA bindings (I'd like Ctrl+Alt+`, but I think that terms don't recognize that one).

    In this external thread is a discussion on trying to do this with Viper mode.

    Once one is fairly used to using less, Gmail, and Vimium, the vim key bindings for browsing are nice to go easy on the hands when mostly reading files. Less hitting the Ctrl which helps the hands/wrists.

  • Short
    Short over 8 years
    I think the OP should pick this for the answer. :)