2

In Evil-Mode, when there is an buffer with alphabet keys bound, such as a help buffer (binding q) or a magit-popup buffer (strangely not a magit status buffer), I need to enter into insert mode in order to reach these bindings.

How can I make these buffers work without having to enter into insert mode?

I have currently unbound and sacrificed q which saves me a lot of trouble, but I am looking for a more general solution.

1
  • For standard Emacs buffers of that ilk, they are probably in special-mode (or a derivative), so you can use special-mode-hook to set up any behaviour you need.
    – phils
    Dec 17, 2018 at 0:23

2 Answers 2

3

You can temporarily permit Emacs keybindings with C-z (to permanently switch to the Emacs state keymap) or with \ (to enter one command that is looked up in the Emacs state keymap).

It's recommended though to customize the initial state of the buffer you're having issues with. You can do this as described in the manual with something along the lines of (evil-set-initial-state 'my-mode 'emacs) in your Emacs config. The currently active state is represented by a <X> style indicator in the modeline. As suggested above Emacs state behaves nearly completely like Emacs would. Motion state is a compromise between it and normal state, it binds all movement commands as known from Vim and permits Emacs keybindings to fall through for keys like q.

1

Just add this to your .emacs file:

(add-hook 'magit-popup-mode-hook
          (lambda ()
             (evil-local-mode 0)))

That will disable Evil just for that mode.

Your Answer

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

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