cofi / evil-leader

<leader> key for evil
GNU General Public License v3.0
315 stars 22 forks source link

evil-leader doesn't work in help-mode #1

Closed marktran closed 12 years ago

marktran commented 12 years ago
  1. C-h b
  2. Try to use leader and it doesn't work

evil-leader doesn't seem to be bound in Help buffers despite working in other buffers and evil-mode being enabled in help-mode. Why is it not bound in help-mode?

cofi commented 12 years ago

By default help-mode buffers come up in motion-state. evil-leader does only bind the leader key in normal-state (or with evil-leader/in-all-states also in emacs-state and insert-state).

That's the reason why it does not work. The reason why I will not change this (well, maybe the variable name to in-most-states), is the scope of the motion state: It's motions and most evil commands will not work. So I think it'd be surprising if evil-leader behaved different.

If you want it nonetheless use this:

(evil-define-key 'motion-state help-mode-map evil-leader/leader evil-leader/map)

or to define for all modes:

(define-key evil-motion-state-map evil-leader/leader evil-leader/map)
marktran commented 12 years ago

Ah. That makes sense.

I still can't get evil-leader working in motion-state with the workarounds you pasted though. , seems to be bound to evil-repeat-find-char-reverse.

cofi commented 12 years ago

Oh I see, the first will not work as the already bound , has precedence.

The second one does nonetheless, try this snippet (adjust the path) with evil's make emacs:

(push "/path/to/evil-leader/" load-path)
(setq evil-leader/leader ",")
(require 'evil-leader)
(evil-leader/set-key "," 'evil-repeat-find-char-reverse)
(define-key evil-motion-state-map evil-leader/leader evil-leader/map)

For a help-mode local binding I'm currently at a loss. You maybe want to ask at the mailinglist implementations-list lists.ourproject.org for a way to have local state maps.

marktran commented 12 years ago

Fantastic—that snippet did what I wanted. Thanks for the help and making evil-leader!