From 4f7594b71fc3390f4d2c4abc965deaa11f264f8b Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Mon, 5 Apr 2021 10:44:24 -0400 Subject: [PATCH] Add web-mode --- emacs/.emacs.d/config/init-web.el | 29 +++++++++++++++++++++++++++++ emacs/.emacs.d/init.el | 1 + 2 files changed, 30 insertions(+) create mode 100644 emacs/.emacs.d/config/init-web.el diff --git a/emacs/.emacs.d/config/init-web.el b/emacs/.emacs.d/config/init-web.el new file mode 100644 index 0000000..0e24400 --- /dev/null +++ b/emacs/.emacs.d/config/init-web.el @@ -0,0 +1,29 @@ +;; -*- 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) + ("\\.html?\\'" . web-mode) + ("\\.jsx?\\'" . web-mode) + ("\\.mako\\'" . web-mode) + ("\\.jinja2\\'" . web-mode)) + :config + (setq web-mode-engines-alist + '(("django" . "\\.jinja2\\'"))) + (add-hook 'web-mode-hook + (lambda () + (when (equal web-mode-content-type "javascript") + (web-mode-set-content-type "jsx")) + (when (or (equal web-mode-content-type "javascript") + (equal web-mode-content-type "jsx")) + (lsp-deferred)))) + :custom + (web-mode-enable-auto-pairing nil)) + +(provide 'init-web) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 96662c5..a054458 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -89,6 +89,7 @@ (require 'init-clojure) (require 'init-lisp) (require 'init-js) +(require 'init-web) (require 'init-yaml) (require 'init-groovy) (require 'init-terraform)