Updating Doom Emacs.

This commit is contained in:
Derek Taylor
2020-06-19 22:43:40 -05:00
parent 0f664d532a
commit a5c86c514a
453 changed files with 13527 additions and 12455 deletions

View File

@@ -1,9 +1,25 @@
;;; lang/web/+html.el -*- lexical-binding: t; -*-
(use-package! web-mode
:mode "\\.\\(?:as\\(?:[cp]x\\)\\|blade\\.php\\|erb\\|hbs\\|j\\(?:inja\\|sp\\)\\|mustache\\|p?html?\\|svelte\\|t\\(?:pl\\.php\\|sx\\|wig\\)\\|vue\\)\\'"
:mode "\\.[px]?html?\\'"
:mode "\\.\\(?:tpl\\|blade\\)\\(?:\\.php\\)?\\'"
:mode "\\.erb\\'"
:mode "\\.l?eex\\'"
:mode "\\.jsp\\'"
:mode "\\.as[cp]x\\'"
:mode "\\.hbs\\'"
:mode "\\.mustache\\'"
:mode "\\.svelte\\'"
:mode "\\.twig\\'"
:mode "\\.jinja2?\\'"
:mode "wp-content/themes/.+/.+\\.php\\'"
:mode "templates/.+\\.php\\'"
:init
;; If the user has installed `vue-mode' then, by appending this to
;; `auto-mode-alist' rather than prepending it, its autoload will have
;; priority over this one.
(add-to-list 'auto-mode-alist '("\\.vue\\'" . web-mode) 'append)
:mode "\\.vue\\'"
:config
(set-docsets! 'web-mode "HTML" "CSS" "Twig" "WordPress")
@@ -13,7 +29,7 @@
'("tidy" "-q" "-indent"
"--tidy-mark" "no"
"--drop-empty-elements" "no"
"--show-body-only" "auto" ; don't inject html/body tags
("--show-body-only" "%s" (if +format-region-p "true" "auto"))
("--indent-spaces" "%d" tab-width)
("--indent-with-tabs" "%s" (if indent-tabs-mode "yes" "no"))
("-xml" (memq major-mode '(nxml-mode xml-mode))))
@@ -46,6 +62,29 @@
"\\(?:>\\|]\\|}\\)+\\'")))))
(delq! nil web-mode-engines-auto-pairs))
(add-to-list 'web-mode-engines-alist '("elixir" . "\\.eex\\'"))
(let ((types '("javascript" "jsx")))
(setq web-mode-comment-formats
(cl-remove-if (lambda (item) (member (car item) types))
web-mode-comment-formats))
(dolist (type types)
(push (cons type "//") web-mode-comment-formats)))
(add-hook! 'web-mode-hook
(defun +web--fix-js-comments-h ()
"Fix comment handling in `web-mode' for JavaScript."
(when (member web-mode-content-type '("javascript" "jsx"))
;; For some reason the default is to insert HTML comments even
;; in JavaScript.
(setq-local comment-start "//")
(setq-local comment-end "")
;; Needed since otherwise the default value generated by
;; `comment-normalize-vars' will key off the syntax and think
;; that a single "/" starts a comment, which completely borks
;; auto-fill.
(setq-local comment-start-skip "// *"))))
(map! :map web-mode-map
(:localleader
:desc "Rehighlight buffer" "h" #'web-mode-buffer-highlight
@@ -124,4 +163,6 @@
(when (featurep! +lsp)
(add-hook! '(html-mode-hook web-mode-hook) #'lsp!))
(add-hook! '(html-mode-local-vars-hook
web-mode-local-vars-hook)
#'lsp!))