cofi / evil-leader

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

Add evil-leader/set-local-key #35

Open lionel- opened 8 years ago

lionel- commented 8 years ago

Not as clean as I initially thought, because there is no convention that minor modes should have hooks. So we have to resort to advices to set local keys. Usage example:

  (defun pandoc-local-keys (&rest args)
    (evil-leader/set-local-key
      "ps" 'some-command
      "po" 'other-command))

  (advice-add 'pandoc-mode :after #'pandoc-local-keys)

If someone has a better approach to the problem of minor-mode specific leader keys, please suggest it.

lionel- commented 8 years ago

Possible alternative: http://endlessparentheses.com/define-context-aware-keys-in-emacs.html