12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- (use-package web-mode
- :pin "MELPA"
- :mode (("\\.html?\\'" . web-mode)
- ("\\.djhtml\\'" . web-mode)
- ("\\.blade.php\\'" . web-mode)
- ("\\.tpl\\'" . web-mode)
- ("\\.twig\\'" . web-mode)
- ("\\.jsp\\'" . web-mode)
- ("\\.gsp\\'" . web-mode)
- ("\\.scss\\'" . web-mode)
- ("\\.tsx\\'" . web-mode)
- ("\\.ctp\\'" . web-mode))
- :config
-
- (setq web-mode-enable-current-element-highlight t)
- (set-face-background 'web-mode-current-element-highlight-face "#616161")
-
- (setq web-mode-engines-alist
- '(("smarty" . "\\.tpl\\'")))
-
-
- (defun my-django-mode ()
- (when (and (require 'web-mode nil t)
- (fboundp 'web-mode-set-engine))
- (if (projectile-project-p)
- (when (file-exists-p (concat (projectile-project-root) "manage.py"))
- (web-mode-set-engine "django")
-
- (setq web-mode-enable-auto-opening t)
- (setq web-mode-enable-auto-closing t)
- (setq web-mode-enable-auto-quoting t)
- (setq web-mode-enable-auto-expanding t)
-
- (require 'smartparens)
- (sp-pair "{% " " %}")
- (sp-pair "{{ " " }}")
- (sp-pair "{# " " #}")
- (sp-pair "{" nil :actions :rem)
- (sp-pair "<" ">")
- (setq web-mode-enable-auto-pairing nil)))))
-
- (defun my-pelican-mode ()
- (when (and (require 'web-mode nil t)
- (fboundp 'web-mode-set-engine))
- (if (projectile-project-p)
- (when (file-exists-p (concat (projectile-project-root) "pelicanconf.py"))
- (web-mode-set-engine "django")
-
- (setq web-mode-enable-auto-opening t)
- (setq web-mode-enable-auto-closing t)
- (setq web-mode-enable-auto-quoting t)
- (setq web-mode-enable-auto-expanding t)
-
- (require 'smartparens)
- (sp-pair "{% " " %}")
- (sp-pair "{" nil :actions :rem)
- (sp-pair "<" ">")
- (setq web-mode-enable-auto-pairing nil)))))
- :hook
- (web-mode . my-django-mode)
- (web-mode . my-pelican-mode))
- (provide 'init-web-mode)
|