summaryrefslogtreecommitdiff
path: root/settings/setup-web-mode.el
blob: 48e300c13b5ed2a51bee7c7db7fadd6b63d09915 (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
(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 '("\\.json\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\'" . 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
      '(("handlebars" . "\\.hbs'")))

(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))

(add-hook 'web-mode-hook 'indent-offset)

(provide 'setup-web-mode)