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:
parent
8bbff852f7
commit
a876d87f5e
2 changed files with 21 additions and 5 deletions
|
@ -105,3 +105,18 @@ function @ http://ergoemacs.org/emacs/elisp_replace_html_entities_command.html"
|
|||
"Decode HTML entities in region."
|
||||
(interactive "r")
|
||||
(+web--entities-region beg end t))
|
||||
|
||||
;;;###autoload
|
||||
(defun +web/indent-or-yas-or-emmet-expand ()
|
||||
"Invoke `indent-for-tab-command' if at or before text bol, `yas-expand' if on
|
||||
a snippet, or `emmet-expand-yas'/`emmet-expand-line', depending on whether
|
||||
`yas-minor-mode' is enabled or not."
|
||||
(interactive)
|
||||
(call-interactively
|
||||
(cond ((<= (current-column) (current-indentation))
|
||||
#'indent-for-tab-command)
|
||||
((bound-and-true-p yas-minor-mode)
|
||||
(if (yas--templates-for-key-at-point)
|
||||
#'yas-expand
|
||||
#'emmet-expand-yas))
|
||||
(#'emmet-expand-line))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue