4.2.3 Binding to keymaps

Normally :bind expects that commands are functions that will be autoloaded from the given package. However, this does not work if one of those commands is actually a keymap, since keymaps are not functions, and cannot be autoloaded using the built-in autoload function.

To handle this case, use-package offers a special, limited variant of :bind called :bind-keymap. The only difference is that the “commands” bound to by :bind-keymap must be keymaps defined in the package, rather than interactive functions. This is handled behind the scenes by generating custom code that loads the package containing the keymap, and then re-executes your keypress after the first load, to reinterpret that keypress as a prefix key.

For example:

(use-package foo
  :bind-keymap ("C-c p" . foo-command-map))