Hooks for entering and exiting Insert State in Evil

Vegard Øye vegard_oye at hotmail.com
Mon Aug 1 14:52:15 CEST 2011


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



More information about the implementations-list mailing list