dotfiles/emacs/.emacs.d/config/init-web.el

32 lines
972 B
EmacsLisp

;; -*- lexical-binding: t; -*-
(use-package web-mode
:mode (("\\.phtml\\'" . web-mode)
("\\.tpl\\.php\\'" . web-mode)
("\\.[agj]sp\\'" . web-mode)
("\\.as[cp]x\\'" . web-mode)
("\\.erb\\'" . web-mode)
("\\.mustache\\'" . web-mode)
("\\.djhtml\\'" . web-mode)
("\\.hbs\\'" . web-mode)
("\\.mako\\'" . web-mode)
("\\.jinja2\\'" . web-mode))
:config
(setq web-mode-engines-alist
'(("django" . "\\.jinja2\\'")))
:custom
(web-mode-enable-auto-pairing nil)
(web-mode-markup-indent-offset 2)
(web-mode-code-indent-offset 2)
(web-mode-script-padding 2))
(define-derived-mode js-web-mode web-mode "JS Web Mode"
"Web mode in JS files.")
(add-to-list 'auto-mode-alist '("\\.jsx?\\'" . js-web-mode))
(define-derived-mode html-web-mode web-mode "HTML Web Mode"
"Web mode in HTML files.")
(add-to-list 'auto-mode-alist '("\\.html?\\'" . html-web-mode))
(provide 'init-web)