I want to have both emmet-mode
and yasnippet
trigger with the same key C-return: in a html-mode
buffer, C-return should first try yas-expand
and then emmet-expand-line
if no suitable snippet was found.
It seems I am missing something about the binding keywords in use-package
. Currently only emmet-mode
's bind is active in a HTML buffer.
lisp/init-emmet.el
(use-package emmet-mode
:defer t
:init
(add-hook 'css-mode-hook 'emmet-mode)
(add-hook 'sgml-mode-hook 'emmet-mode)
:config
(setq-default
emmet-move-cursor-between-quotes t
emmet-preview-default nil)
(unbind-key "C-M-<left>" emmet-mode-keymap)
(unbind-key "C-M-<right>" emmet-mode-keymap))
lisp/init-yasnippet.el
(use-package yasnippet
:defer t
:bind (:map yas-minor-mode-map ("<C-return>" . yas-expand))
:init
(add-hook 'js-mode-hook 'yas-minor-mode)
(add-hook 'sgml-mode-hook 'yas-minor-mode)
:config
(setq-default yas-snippet-dirs '("~/.emacs.d/snippets"))
(yas-reload-all)
(unbind-key "TAB" yas-minor-mode-map))
:map
tobind-keys*
(including via:bind*
) doesn't do anything; it will ignore the map argument and bind its keys inoverride-global-map
.