emmet-mode: bind to TAB & enable in reason-mode

TAB now either indents, expands the snippet at point, or expands the
emmet expression at point.

Also it now falls back to emmet-expand-line if yasnippet won't load.
This commit is contained in:
Henrik Lissner 2018-08-01 19:25:06 +02:00
parent 8bbff852f7
commit a876d87f5e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 21 additions and 5 deletions

View file

@ -16,14 +16,15 @@
(def-package! emmet-mode
:commands emmet-mode
:preface (defvar emmet-mode-keymap (make-sparse-keymap))
:hook (css-mode web-mode html-mode haml-mode nxml-mode rjsx-mode)
:hook (css-mode web-mode html-mode haml-mode nxml-mode rjsx-mode reason-mode)
:config
(when (require 'yasnippet nil t)
(add-hook 'emmet-mode-hook #'yas-minor-mode-on))
(setq emmet-move-cursor-between-quotes t)
(add-hook! 'rjsx-mode-hook
(setq-local emmet-expand-jsx-className? t))
(setq-hook! 'rjsx-mode-hook emmet-expand-jsx-className? t)
(map! :map emmet-mode-keymap
:v "M-e" #'emmet-wrap-with-markup
:i "M-e" #'emmet-expand-yas
:v [tab] #'emmet-wrap-with-markup
:i [tab] #'+web/indent-or-yas-or-emmet-expand
:i "M-E" #'emmet-expand-line))