Typing jk deletes j and returns to normal mode

As the title says. If I type j then k fast enough, while in insert mode, I exit insert mode. Why?

1 Like

This behavior is not a bug. This is the evil-escape package doing its job. Quickly typing j then k is a shortcut for evil users to exit insert mode.

The behavior may not be intuitive if you haven’t seen it before. It is a common trick used by vimmers who want an easier-to-reach alternative to ESC for exiting insert mode:

:imap jk <Esc>

:pushpin: Two other shortcuts for exiting insert mode are C-[ and Emacs’ universal “quit” key C-g.

To disable this behavior, any of the following will work:

  • Change evil-escape-key-sequence (default is jk). Maybe you prefer fd, or something else?

    ;; in ~/.doom.d/config.el
    (after! evil-escape 
      (setq evil-escape-key-sequence "fd"))
    
  • Decrease evil-escape-delay (default is 0.15 in seconds). If it’s shorter, the chance of accidentally invoking evil-escape on jk is lower.

    ;; in ~/.doom.d/config.el
    (after! evil-escape 
      (setq evil-escape-delay 0.05))
    
  • Or disable its global minor mode immediately:

    ;; in ~/.doom.d/config.el
    (after! evil-escape
      (evil-escape-mode -1))
    
  • Disable the package entirely:

    • Add (package! evil-escape :disable t) to ~/.doom.d/packages.el
    • Run ~/.emacs.d/bin/doom sync on the command line
    • Restart Emacs.
3 Likes