blob: f6eb5155eb28113d4b38d7c5ab5e0c0452610350 (
plain) (
blame)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
;;; init-web.el --- Web Configuration File -*- lexical-binding: t -*-
;;; Commentary:
;; Some parts copied from prelude-web.el, prelude-js.el and prelude-css.el
;;; Code:
(use-package web-mode
:custom
(web-mode-enable-auto-pairing nil)
:config
(sp-with-modes '(web-mode)
(sp-local-pair "%" "%"
:unless '(sp-in-string-p)
:post-handlers '(((lambda (&rest _ignored)
(just-one-space)
(save-excursion (insert " ")))
"SPC" "=" "#")))
(sp-local-tag "%" "<% " " %>")
(sp-local-tag "=" "<%= " " %>")
(sp-local-tag "#" "<%# " " %>"))
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.hbs\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.blade\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.jsp\\'" . 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 '("\\.html?\\'" . web-mode))
(add-to-list 'auto-mode-alist '("/\\(views\\|html\\|theme\\|templates\\)/.*\\.php\\'" . web-mode)))
(use-package css-mode
:custom
(css-indent-offset 2)
:config
(rainbow-mode +1))
(use-package scss-mode
:config
(add-to-list 'auto-mode-alist '("\\.scss\\'" . scss-mode))
:custom
(scss-compile-at-save nil))
(use-package sass-mode)
(use-package tagedit
:diminish
:config (tagedit-add-paredit-like-keybindings)
:hook (html-mode . (lambda () (tagedit-mode 1))))
(use-package js2-mode
:config
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
:custom
(js-indent-level 2)
:hook (js2-mode . (lambda ()
(setq-local electric-layout-rules '((?\; . after)))
(setq mode-name "JS2")
(js2-imenu-extras-mode +1)
(subword-mode +1))))
(use-package mustache-mode
:config
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . mustache-mode)))
(provide 'init-web)
;;; init-web.el ends here
|