use-package evil configuration in the text.This is my
use-package configuration(use-package evil
:ensure t
:custom (evil-want-fine-undo t)
:custom (evil-undo-system 'undo-fu)
:config
(evil-mode 1)
(define-key evil-normal-state-map (kbd "g ESC") 'ESC-prefix)
;; More configuration goes here
(use-package evil-leader
:ensure t
:config
(global-evil-leader-mode))
(use-package evil-surround
:ensure t
:config
(global-evil-surround-mode))
(use-package evil-indent-textobject
:ensure t)
)
evil-org
(use-package evil-org
:config
(progn
(add-hook 'org-mode-hook 'evil-org-mode)
(evil-org-set-key-theme '(navigation insert textobjects additional))
)
)
vterm
(use-package vterm
:config
(with-eval-after-load 'evil (evil-set-initial-state 'vterm-mode 'insert))
(add-hook 'vterm-mode-hook
(lambda ()
(define-key evil-insert-state-local-map (kbd "C-r") #'vterm-send-C-r)))
:bind (:map vterm-mode-map
("C-r" . vterm-send-C-r))
;; check what shadowing means here. It is overridden by evil-insert-state-mode-map
)
I have been installing some new non texting editing packages and this is where I have been getting problems because
evil-mode interferes with their command key transients because those transients buffers or the windows that control them seem to slip back into normal-mode.vulpea-ui
(use-package vulpea-ui
:defer t
:ensure nil
:quelpa
(vulpea-ui
:fetcher github
:repo "d12frosted/vulpea-ui"
:commit "e8766fa")
:config
(evil-set-initial-state 'vulpea-ui-collection-mode 'emacs)
)
excali
(use-package excali
:ensure nil
:load-path "site-lisp/excali-mode/"
:commands (excali-open excali-new)
:config
(evil-set-initial-state 'excali-mode-hook 'emacs)
:hook ((excali-mode . turn-off-evil-mode)
(excali-library-mode . turn-off-evil-mode)
(excali-library-official . turn-off-evil-mode)
(excali-library-official-preview . turn-off-evil-mode)
(excali-dsl-mode . turn-off-evil-mode))
)
canvas-browser is another one I will have to devote my attention to.
The problem is even after setting them to emacs ie
(evil-set-initial-state 'vulpea-ui-collection-mode 'emacs) or :hook ((excali-mode . turn-off-evil-mode)) they switch back to normal-mode with N in the mode line and I wonder what is going behind the scenes.It seems that during some of the interactions some new replacement /shadow buffers are created or some operations turn the emacs-mode buffers back to normal-mode and those states must be trapped or reverted.
Which brings me to a question is
(evil-set-initial-state 'some-mode 'emacs) a better way to turn off evil mode than :hook (some-mode . turn-off-evil-mode)?What foolproof way is there of telling when a window has unexpectedly switched to
evil-mode, or has been created with evil-mode ie mode-line contains N so I can use the right commands to turn off evil-mode in that window?Is it possible for some mode to be activated in a window without some hook firing?
https://redd.it/1wyagc3
@r_emacs