Fix eat in terminal and eat char mode with evil

This commit is contained in:
Alexander Rosenberg 2025-02-11 01:15:55 -08:00
parent 3f23480cb9
commit de206d7b93
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

16
init.el
View File

@ -2388,12 +2388,7 @@ argument."
:config :config
;; The below makes sure that the first time the ESC key is pressed, it does ;; The below makes sure that the first time the ESC key is pressed, it does
;; what it is supposed to ;; what it is supposed to
(defun my/-fix-eat-evil-keymap () (add-hook 'eat--semi-char-mode-hook #'evil-normalize-keymaps)
(evil-normalize-keymaps)
(remove-hook 'eat-update-hook #'my/-fix-eat-evil-keymap t))
(defun my/-setup-eat-terminal-keymap-fix ()
(add-hook 'eat-update-hook #'my/-fix-eat-evil-keymap nil t))
(add-hook 'eat-mode-hook #'my/-setup-eat-terminal-keymap-fix)
(defun my/-evil-disable-cursor-in-eat-buffer (oldfun &rest r) (defun my/-evil-disable-cursor-in-eat-buffer (oldfun &rest r)
"Disable `evil--sw-refresh-cursor' in `eat-mode' buffers." "Disable `evil--sw-refresh-cursor' in `eat-mode' buffers."
(when (or (not (derived-mode-p 'eat-mode)) (when (or (not (derived-mode-p 'eat-mode))
@ -2401,6 +2396,15 @@ argument."
(apply oldfun r))) (apply oldfun r)))
(advice-add 'evil--sw-refresh-cursor :around (advice-add 'evil--sw-refresh-cursor :around
#'my/-evil-disable-cursor-in-eat-buffer) #'my/-evil-disable-cursor-in-eat-buffer)
(defun my/-eat-update-cursor-on-tty (&rest r)
(etcc--evil-set-cursor))
(advice-add 'eat--set-cursor :after
#'my/-eat-update-cursor-on-tty)
(defun my/-eat-disable-evil-in-char-mode ()
(if eat--char-mode
(evil-local-mode -1)
(evil-local-mode 1)))
(add-hook 'eat--char-mode-hook #'my/-eat-disable-evil-in-char-mode)
;; Evil fixes done ;; Evil fixes done
(defvar my/project-eat-hash-table (make-hash-table :test 'equal) (defvar my/project-eat-hash-table (make-hash-table :test 'equal)