I want to disable evil insert key such as
read-only mode (keep navigation key such as
k), my idea is to disable these keys in local buffer when enabling
read-only mode and enable these keys after disabling
There are two difficulties for me:
- How to disable evil insert key.
- How to execute code when enable/disable mode.
I notice there is
evil-disable-insert-state-bindings variable. I try to set it to
t in local buffer, but
i keys still work.
I know I can use
(add-hook 'read-only-mode-hook (lambda () (message "read-only-mode changed"))) to detect mode change, but I don't know how to distinguish enabling and disabling mode.