home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

programming-web.el (1356B)


      1 ;;; programming-web.el --- -*- lexical-binding: t -*-
      2 ;;; Commentary:
      3 ;;; Programming the Web related configuration
      4 ;;; Code:
      5 
      6 (use-package web-mode
      7   :commands (web-mode)
      8   :mode
      9   ("\\.html\\'" . web-mode)
     10   ("\\.phtml\\'" . web-mode)
     11   ("\\.[agj]sp\\'" . web-mode)
     12   ("\\.as[cp]x\\'" . web-mode)
     13   ("\\.erb\\'" . web-mode)
     14   ("\\.mustache\\'" . web-mode)
     15   ("\\.djhtml\\'" . web-mode)
     16   ("\\.jsp\\'" . web-mode)
     17   ("\\.eex\\'" . web-mode)
     18   ("\\.tsx\\'" . web-mode)
     19   :config
     20   (setq web-mode-attr-indent-offset 2)
     21   (setq web-mode-code-indent-offset 2)
     22   (setq web-mode-css-indent-offset 2)
     23   (setq web-mode-indent-style 2)
     24   (setq web-mode-markup-indent-offset 2)
     25   (setq web-mode-sql-indent-offset 2)
     26   (eval-after-load 'smartparens
     27     (lambda ()
     28       (setq web-mode-enable-auto-pairing nil)
     29       (sp-with-modes '(web-mode)
     30         (sp-local-pair "%" "%"
     31                        :unless '(sp-in-string-p)
     32                        :post-handlers '(((lambda (&rest _ignored)
     33                                            (just-one-space)
     34                                            (save-excursion (insert " ")))
     35                                          "SPC" "=" "#")))
     36         (sp-local-tag "%" "<% "  " %>")
     37         (sp-local-tag "=" "<%= " " %>")
     38         (sp-local-tag "#" "<%# " " %>")))))
     39 
     40 (provide 'programming-web)
     41 ;;; programming-web.el ends here