Hooks for entering and exiting Insert State in Evil
Hi, It seems to me that there are no hooks for entering and exiting Insert State in evil. So I'm doing the following workaround: (defadvice evil-insert ...) (defadvice evil-normal-state ...) The advice for `evil-insert' seems to be working but the advice for `evil-normal-state' was always being called even after entering Insert state. Can these hooks be added in evil? Or, is there any other mechanism for this? Thanks, York
On 2011-07-31 21:21 +0200, York Zhao wrote:
It seems to me that there are no hooks for entering and exiting Insert State in evil.
Evil provides entry and exit hooks for all of its states: `evil-normal-state-entry-hook' [Variable] Run when entering Normal state. `evil-normal-state-exit-hook' [Variable] Run when exiting Normal state. `evil-insert-state-entry-hook' [Variable] Run when entering Insert state. `evil-insert-state-exit-hook' [Variable] Run when exiting Insert state. `evil-visual-state-entry-hook' [Variable] Run when entering Visual state. `evil-visual-state-exit-hook' [Variable] Run when exiting Visual state. `evil-replace-state-entry-hook' [Variable] Run when entering Replace state. `evil-replace-state-exit-hook' [Variable] Run when exiting Replace state. `evil-operator-state-entry-hook' [Variable] Run when entering Operator-Pending state. `evil-operator-state-exit-hook' [Variable] Run when exiting Operator-Pending state. `evil-motion-state-entry-hook' [Variable] Run when entering Motion state. `evil-motion-state-exit-hook' [Variable] Run when exiting Motion state. `evil-emacs-state-entry-hook' [Variable] Run when entering Emacs state. `evil-emacs-state-exit-hook' [Variable] Run when exiting Emacs state. When these hooks are run, the variables `evil-next-state' and `evil-previous-state' hold information about the states being switched to and from. `evil-next-state' [Variable] The state being switched to. `evil-previous-state' [Variable] The state being switched from. Finally, all states have a predicate function `evil-STATE-state-p' which returns t when STATE is active. For example, (evil-insert-state-p) will check whether the current state is Insert state, and (evil-insert-state-p evil-previous-state) will check whether the previous state was Insert state. -- Vegard
Hi Vegard, Thanks a lot for this elaborative list, very useful. York On Mon, Aug 1, 2011 at 8:52 AM, Vegard Øye <[email protected]> wrote: On 2011-07-31 21:21 +0200, York Zhao wrote:
It seems to me that there are no hooks for entering and exiting Insert State in evil.
Evil provides entry and exit hooks for all of its states: `evil-normal-state-entry-hook' [Variable] Run when entering Normal state. `evil-normal-state-exit-hook' [Variable] Run when exiting Normal state. `evil-insert-state-entry-hook' [Variable] Run when entering Insert state. `evil-insert-state-exit-hook' [Variable] Run when exiting Insert state. `evil-visual-state-entry-hook' [Variable] Run when entering Visual state. `evil-visual-state-exit-hook' [Variable] Run when exiting Visual state. `evil-replace-state-entry-hook' [Variable] Run when entering Replace state. `evil-replace-state-exit-hook' [Variable] Run when exiting Replace state. `evil-operator-state-entry-hook' [Variable] Run when entering Operator-Pending state. `evil-operator-state-exit-hook' [Variable] Run when exiting Operator-Pending state. `evil-motion-state-entry-hook' [Variable] Run when entering Motion state. `evil-motion-state-exit-hook' [Variable] Run when exiting Motion state. `evil-emacs-state-entry-hook' [Variable] Run when entering Emacs state. `evil-emacs-state-exit-hook' [Variable] Run when exiting Emacs state. When these hooks are run, the variables `evil-next-state' and `evil-previous-state' hold information about the states being switched to and from. `evil-next-state' [Variable] The state being switched to. `evil-previous-state' [Variable] The state being switched from. Finally, all states have a predicate function `evil-STATE-state-p' which returns t when STATE is active. For example, (evil-insert-state-p) will check whether the current state is Insert state, and (evil-insert-state-p evil-previous-state) will check whether the previous state was Insert state. -- Vegard _______________________________________________ implementations-list mailing list [email protected] https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
participants (2)
-
Vegard Øye -
York Zhao