summaryrefslogtreecommitdiff
path: root/settings/setup-web-mode.el
blob: e476dc2726b0a20591fb501f2bd4cee8ce38ccb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(require 'web-mode)

(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.ejs\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.hbs\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.js\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.ts\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.eex\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.svelte\\'" . web-mode))


(set-face-attribute 'web-mode-doctype-face nil :foreground "misty rose")
(set-face-attribute 'web-mode-html-tag-face nil :foreground "medium slate blue")
(set-face-attribute 'web-mode-html-attr-name-face nil :foreground "orange")
(set-face-attribute 'web-mode-html-tag-bracket-face nil :foreground "gray")
(set-face-attribute 'web-mode-block-control-face nil :foreground "deep sky blue")
(set-face-attribute 'web-mode-block-delimiter-face nil :foreground "medium aquamarine")

(setq web-mode-engines-alist
      '(("django" . "\\.html\\'")))

(defun indent-offset ()
  "Hooks for web mode."
  (setq web-mode-markup-indent-offset 2)
  (setq web-mode-code-indent-offset 2)
  (setq web-mode-css-indent-offset 2)
  (setq web-mode-style-padding 2)
  (setq web-mode-script-padding 2))

;; (eval-after-load 'web-mode
;;   '(add-hook 'web-mode-hook #'add-node-modules-path))

(add-hook 'web-mode-hook 'indent-offset)
;(add-hook 'web-mode-hook 'prettier-js-mode)

(provide 'setup-web-mode)