Skip to content

Instantly share code, notes, and snippets.

@gongo
Created April 1, 2015 12:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gongo/a27096d6952802943d1e to your computer and use it in GitHub Desktop.
Save gongo/a27096d6952802943d1e to your computer and use it in GitHub Desktop.
Syntax highlighting/support for vueify file (.vue) using mmm-mode
(require 'mmm-mode)
(setq mmm-global-mode 'maybe)
(dolist (langsets '(("script" . ((coffee . coffee-mode)
(es6 . js2-mode)))
("style" . ((stylus . stylus-mode)
(less . less-css-mode)
(scss . scss-mode)))))
(let ((tag (car langsets)))
(dolist (pair (cdr langsets))
(let* ((lang (car pair))
(submode (cdr pair))
(class-name (make-symbol (format "vueify-%s-%s" tag lang)))
(front (format "<%s lang=\"%s\">" tag lang))
(back (format "</%s>" tag)))
(mmm-add-classes
`((,class-name
:submode ,submode
:front ,front
:back ,back)))
(mmm-add-mode-ext-class nil "\\.vue?\\'" class-name)))))
(add-to-list 'auto-mode-alist '("\\.vue?\\'" . web-mode))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment