9

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 – Croad Langshan Jun 12 '16 at 16:53
11

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 '15 at 13:36
  • 2
    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) – Aaron Jensen Dec 2 '15 at 6:31
4

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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