4

I am using evil-mode, magit, evil-magit, and bind-map.

I have defined a map with bind-map using SPC as my :evil-keys similarly to what spacemacs provides.

Magit defines SPC as magit-diff-show-or-scroll-up and I'm having a rough time trying to override that binding or make my bind-map take precedence so I can invoke my leader key.

I have tried to deduce how spacemacs handles this issue but I believe it may be within their evilified* functions.

1 Answer 1

3

Without seeing your code, it sounds to me like you have SPC bound in one of the global evil maps (through bind-map), like evil-normal-state-map. evil-magit makes magit-mode-map an overriding map which makes its bindings shadow the global evil ones. Therefore, you need to bind SPC at a precedence level that matches or exceeds this. There are at least two ways to do this.

  1. Bind your my-map (whatever you call it) directly in magit-mode-map for the state you want, using something like (evil-define-key 'normal magit-mode-map (kbd "SPC") my-map). This will target just the purpose you outlined.

  2. Try adding :override-minor-modes t to your bind-map declaration, which essentially elevates the precedence of that binding globally. This could change the way your bindings work in other modes.

1
  • Thank you, I tried the first one and it solved my issue. I will keep the second one in mind. I actually had a variation of the first one in my config but I used "motion" instead of "normal".
    – feevo
    Nov 30, 2017 at 15:47

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.