Last active
April 29, 2020 10:00
-
-
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 :-)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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