Add some evil fixes to eat

This commit is contained in:
Alexander Rosenberg 2025-02-10 23:26:17 -08:00
parent d65948ca41
commit 3f23480cb9
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

21
init.el
View File

@ -2381,7 +2381,28 @@ argument."
("M-o" . ace-window) ("M-o" . ace-window)
:map eat-eshell-semi-char-mode-map :map eat-eshell-semi-char-mode-map
("M-o" . ace-window)) ("M-o" . ace-window))
:init
(evil-define-key 'insert eat-semi-char-mode-map
(kbd "<escape>") #'eat-self-input
(kbd "C-S-n") #'evil-normal-state)
:config :config
;; The below makes sure that the first time the ESC key is pressed, it does
;; what it is supposed to
(defun my/-fix-eat-evil-keymap ()
(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)
"Disable `evil--sw-refresh-cursor' in `eat-mode' buffers."
(when (or (not (derived-mode-p 'eat-mode))
(not (eq evil-state 'insert)))
(apply oldfun r)))
(advice-add 'evil--sw-refresh-cursor :around
#'my/-evil-disable-cursor-in-eat-buffer)
;; 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)
"Hash table that maps project root dirs to eat buffers.") "Hash table that maps project root dirs to eat buffers.")
(defun my/-eat-shell-for-cwd () (defun my/-eat-shell-for-cwd ()