With evil-mode, I found myself pressing escape very often, but it's a bit far to reach. Also, it seems semantic wise, keyboard-quit is similar to evil-force-normal-state, so I would like to use C-g for both of them with the following conditional logic that Only when cursor is a buffer with evil-mode's insert state, then C-g should execute evil-force-normal-state, other it should execute its normal binding of keyboard-quit
I guess that there might be a sub-key-map for evil with insert state?
If you have ready example, I'd appreciate your sharing.
In the meantime, I'll check the possibility of customizing the key-binding with evil's input state. I'm studying this link now:
I tried the following, but it didn't work:
(evil-define-key 'insert evil-insert-state-map (kbd "C-g") 'evil-normal-state)
and
(evil-define-key 'insert evil-insert-state-map (kbd "C-g") 'evil-force-normal-state)
C-g still executes keyboard-quit
I found that I can use key-chord to execute evil-force-normal-state:
(key-chord-define evil-normal-state-map ",," 'evil-force-normal-state)
(key-chord-define evil-visual-state-map ",," 'evil-change-to-previous-state)
(key-chord-define evil-insert-state-map ",," 'evil-normal-state)
(key-chord-define evil-replace-state-map ",," 'evil-normal-state)
Thanks,