I'd like to be able to exit view mode by pressing "q". However, in evil "q" is bound to evil-record-macro
, even in view mode. I wasn't able to find a solution using evil-define-key
.
I was excited to find a similar question here, which proposes using eval-after-load
, like so:
(defun testing ()
(interactive)
(message "Testing..."))
(eval-after-load "view" '(evil-define-key 'normal view-mode-map "q" #'testing))
This produces some strange behavior. When I enter view mode, C-h k q
reports the following: "q runs the command evil-record-macro (found in evil-normal-state-map)... It is bound to q.". But, I discovered that if I do press "q", record a macro, and press "q" again to exit the recording, I see the "Testing..." message. Following this, pressing "q" continues to produce the message, and I no longer enter macro recording. "C-h k q" reports: q runs the command testing... It is bound to q, <normal-state> q.
Can someone propose a solution or workaround? Thanks!