Binding in keymaps (use-package User Manual)

Next: , Previous: , Up: Key bindings [Contents][Index]


4.2.2 Key bindings in local keymaps

Slightly different from binding a key to a keymap, is binding a key within a local keymap that only exists after the package is loaded. use-package supports this with a :map modifier, taking the local keymap to bind to:

(use-package helm
 :bind (:map helm-command-map
 ("C-c h" . helm-execute-persistent-action)))

The effect of this is to wait until helm has loaded, and then to bind the key sequence C-c h to helm-execute-persistent-action within Helm’s local keymap, helm-command-map.

Multiple uses of :map may be specified. Any binding occurring before the first use of :map are applied to the global keymap:

(use-package term
 :bind (("C-c t" . term)
 :map term-mode-map
 ("M-p" . term-send-up)
 ("M-n" . term-send-down)
 :map term-raw-map
 ("M-o" . other-window)
 ("M-p" . term-send-up)
 ("M-n" . term-send-down)))

AltStyle によって変換されたページ (->オリジナル) /