Skip to content

Instantly share code, notes, and snippets.

@syl20bnr
Last active April 29, 2020 10:00
Show Gist options
  • Save syl20bnr/4447166 to your computer and use it in GitHub Desktop.
Save syl20bnr/4447166 to your computer and use it in GitHub Desktop.
evil-emacs-state is annoying, the following function and hook automatically switches back to evil-normal-state whenever the evil-emacs-state is entered. It allows a more consistent navigation experience among all mode maps. To enter special commands of custom mode maps, just enter the insert mode :-)
;; evil-emacs-state is annoying, the following function and hook automatically
;; switch back to evil-normal-state whenever the evil-emacs-state is entered.
;; It allows a more consistent navigation experience among all mode maps.
;; To enter special commands of custom mode maps, just enter the insert mode :-)
(defun evil-emacs-state-2-evil-normal-state ()
(evil-normal-state)
(remove-hook 'post-command-hook 'evil-emacs-state-2-evil-normal-state))
(add-hook 'evil-emacs-state-entry-hook
(lambda ()
(add-hook 'post-command-hook 'evil-emacs-state-2-evil-normal-state)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment