Binding `evil-normal-state` key does not work

Hi,

This is my first day using emacs and I feel a bit embarassed about this question, but it just does not work for me.

What happened?

So, I would like to rebind ESC key, which is used for leaving insert state and going back to normal state in evil mode.

I have tried the following versions, only one at a time:

(after! evil
  (define-key evil-insert-state-map (kbd "qq") 'evil-normal-state))
(after! evil
  (evil-define-key 'insert 'global (kbd "qq") 'evil-normal-state))
(after! evil
  (map! :map evil-insert-state-map "C-," #'evil-normal-state))

In this last example I have changed qq to C-, to see if there is some conflicting binding issue or similar, but before and after adding this line emacs reports C-, is undefined.

What did you expect to happen?

It should leave insert state and go back to normal state when qq pressed.

Steps to reproduce

  1. Install Doom Emacs
  2. Open doom/config.el, add one of those lines shown above.
  3. Restart Emacs with SPC-q-r
  4. Try to leave insert mode with qq. (No luck yet.)

I am not sure if qq is the right way to write double q press, that’s why I have tried different bindings too. I am also confused about the # before the ' in the last example, no idea if those matter or not. I am not familiar with Lisp/Scheme either :-(

System information


Loading data dump...

Maybe try to run doom/reload or doom sync? Your third block seems to work for me as is.

It also works if I do:

(map! (:after evil
      :i "C-," #'evil-normal-state))

So you might want to try that. Might also want to change :i to something like :iv or :ir is you want to also do this to exit visual or replace states, for example.

But also, I feel like you should try to get used to ESC first, before trying to change this. To keep your learning a bit more applicable to other stuff with vi-like bindings. If you find if uncomfortable, consider switching ESC with Caps Lock at the OS or keyboard level, unless you use Caps Lock a lot.

The doom/reload command was the missing step, thanks.

I have to rebind, because ESC key does not work, but I will try Your suggestion about CapsLock.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.