I use evil. Normally, when I commit, I'd like to immediately start typing, but evil starts the buffer in evil-normal-state. I used to set

(evil-set-initial-state #'git-commit-mode 'insert)

But that no longer works, as Magit uses text-mode for its commit buffers.

How can I have Magit commits default to evil-insert-state?

  • I'm using git-commit-mode-hook and that (still) works for me Jun 12, 2016 at 16:53

2 Answers 2


Here's a workaround:

(add-hook 'with-editor-mode-hook 'evil-insert-state)

I'm not sure why the initial state system was chosen as it either means you have a huge whitelist of states or do lookup of derived modes, the hooks system is a much more natural fit for Evil IMO.

  • Cool, this works perfectly!
    – PythonNut
    Jul 16, 2015 at 13:36
  • 3
    If you are using spacemacs, which does use git-commit-mode, you can be more specific with (add-hook 'git-commit-mode-hook 'evil-insert-state) Dec 2, 2015 at 6:31

(add-hook 'git-commit-mode-hook 'evil-insert-state) works

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.