Doom-emacs: [HOWTO] Add keybinding but not affect the existing keybindings

Created on 15 Mar 2020  路  5Comments  路  Source: hlissner/doom-emacs

When I try to add keybindings to existing ones, for example, add another keybinding with prefix g s, it seems that it will fully override all the keybindings with prefix g s.

;; in my config.el
(map!
 (:prefix "g"
   (:prefix "s"
     :nv "l" #'avy-goto-word-0)))

image

Can I add keybindings without override the existing ones?

:editor evil question elisp keybinds resolved

Most helpful comment

To add keys to evil-easymotion, you need to add it to evilem-map (with no prefix):

(map! :after evil-easymotion
      :map evilem-map
      "l" #'avy-goto-word-0)

All 5 comments

Try just :prefix instead of :prefix-map, which I think is only supposed to be used by the default/ evil modules

Try just :prefix instead of :prefix-map, which I think is only supposed to be used by the default/ evil modules

I change :prefix-map to :prefix, but it seems it still not work. The strange thing is that if I don't have this map! call in my config file before launching emacs, then add this call to my config file, then hit C-x C-e to run it, then it will works fine, both origin key binding and my customize key binding will works. But if I put this in my config file before launching emacs, the problem will occur.

I can reproduce this; the suggestion in issue 1062 just overwrites the existing g s bindings.

To add keys to evil-easymotion, you need to add it to evilem-map (with no prefix):

(map! :after evil-easymotion
      :map evilem-map
      "l" #'avy-goto-word-0)

To add keys to evil-easymotion, you need to add it to evilem-map (with no prefix):

(map! :after evil-easymotion
      :map evilem-map
      "l" #'avy-goto-word-0)

Thank you, it works!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

governorgoat picture governorgoat  路  3Comments

benjaminbauer picture benjaminbauer  路  3Comments

Ptival picture Ptival  路  3Comments

Vvkmnn picture Vvkmnn  路  3Comments

nasoundead picture nasoundead  路  3Comments