6

When writing elisp for evil mode, how can you check the currently active evil state?
(normal, visual, insert... etc)

Drew
  • 77,472
  • 10
  • 114
  • 243
ideasman42
  • 8,786
  • 1
  • 32
  • 114

1 Answers1

11

The state can be accessed via evil-state, eg:

(cond
 ((eq evil-state 'visual) (do-something))
 ((eq evil-state 'normal) (do-other-thing))
 ((eq evil-state 'insert) (do-another-thing)))
wasamasa
  • 22,178
  • 1
  • 66
  • 99
ideasman42
  • 8,786
  • 1
  • 32
  • 114