2015-08-01 14:58:51 +00:00
|
|
|
;;; packages.el --- HTML Layer packages File for Spacemacs
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
2021-03-22 20:11:29 +00:00
|
|
|
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
2021-03-24 03:31:44 +00:00
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
;;
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
;;
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2015-01-14 04:12:56 +00:00
|
|
|
|
2015-04-19 03:40:24 +00:00
|
|
|
(setq html-packages
|
2015-08-27 11:21:24 +00:00
|
|
|
'(
|
|
|
|
add-node-modules-path
|
|
|
|
company
|
2017-07-03 07:52:54 +00:00
|
|
|
(company-web :requires company)
|
2015-08-27 11:21:24 +00:00
|
|
|
css-mode
|
|
|
|
emmet-mode
|
|
|
|
evil-matchit
|
|
|
|
flycheck
|
|
|
|
haml-mode
|
2019-12-14 17:54:41 +00:00
|
|
|
(counsel-css :requires ivy)
|
2017-07-03 07:52:54 +00:00
|
|
|
(helm-css-scss :requires helm)
|
2015-08-27 11:21:24 +00:00
|
|
|
impatient-mode
|
|
|
|
less-css-mode
|
2018-06-19 06:25:33 +00:00
|
|
|
prettier-js
|
2015-08-27 11:21:24 +00:00
|
|
|
pug-mode
|
|
|
|
sass-mode
|
|
|
|
scss-mode
|
|
|
|
slim-mode
|
|
|
|
smartparens
|
|
|
|
tagedit
|
|
|
|
web-mode
|
|
|
|
yasnippet
|
2021-03-16 17:47:15 +00:00
|
|
|
web-beautify))
|
|
|
|
|
2014-12-16 03:23:55 +00:00
|
|
|
|
2017-03-31 23:38:43 +00:00
|
|
|
(defun html/post-init-add-node-modules-path ()
|
|
|
|
(add-hook 'css-mode-hook #'add-node-modules-path)
|
|
|
|
(add-hook 'less-css-mode-hook #'add-node-modules-path)
|
|
|
|
(add-hook 'pug-mode-hook #'add-node-modules-path)
|
|
|
|
(add-hook 'sass-mode-hook #'add-node-modules-path)
|
|
|
|
(add-hook 'scss-mode-hook #'add-node-modules-path)
|
|
|
|
(add-hook 'slim-mode-hook #'add-node-modules-path)
|
|
|
|
(add-hook 'web-mode-hook #'add-node-modules-path))
|
|
|
|
|
2016-05-30 02:39:21 +00:00
|
|
|
(defun html/post-init-company ()
|
2019-05-08 13:06:17 +00:00
|
|
|
(unless css-enable-lsp
|
|
|
|
(spacemacs|add-company-backends
|
|
|
|
:backends company-css
|
|
|
|
:modes css-mode)))
|
2015-08-10 12:43:29 +00:00
|
|
|
|
2016-05-30 02:39:21 +00:00
|
|
|
(defun html/init-company-web ()
|
2016-12-14 05:55:04 +00:00
|
|
|
(use-package company-web
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-12-14 05:55:04 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2017-01-02 05:39:04 +00:00
|
|
|
(spacemacs|add-company-backends
|
|
|
|
:backends (company-web-html company-css)
|
2018-10-29 17:16:44 +00:00
|
|
|
:modes web-mode)
|
2017-01-02 05:39:04 +00:00
|
|
|
(spacemacs|add-company-backends
|
|
|
|
:backends company-web-jade
|
|
|
|
:modes pug-mode)
|
|
|
|
(spacemacs|add-company-backends
|
|
|
|
:backends company-web-slim
|
|
|
|
:modes slim-mode))))
|
2015-08-10 12:43:29 +00:00
|
|
|
|
2015-04-09 03:57:22 +00:00
|
|
|
(defun html/init-css-mode ()
|
|
|
|
(use-package css-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2015-04-09 03:57:22 +00:00
|
|
|
:init
|
2015-08-28 06:07:17 +00:00
|
|
|
(progn
|
2015-10-14 19:32:43 +00:00
|
|
|
;; Mark `css-indent-offset' as safe-local variable
|
|
|
|
(put 'css-indent-offset 'safe-local-variable #'integerp)
|
|
|
|
|
2019-05-08 13:06:17 +00:00
|
|
|
(when css-enable-lsp
|
|
|
|
(add-hook 'css-mode-hook
|
2019-10-06 03:29:43 +00:00
|
|
|
#'spacemacs//setup-lsp-for-web-mode-buffers t))
|
2019-05-08 13:06:17 +00:00
|
|
|
|
2019-03-30 05:15:16 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'css-mode "m=" "format")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'css-mode "mg" "goto")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'css-mode "mz" "foldz")
|
|
|
|
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'css-mode
|
2018-05-18 04:46:12 +00:00
|
|
|
"zc" 'spacemacs/css-contract-statement
|
2018-05-18 05:15:03 +00:00
|
|
|
"zo" 'spacemacs/css-expand-statement))))
|
2015-04-09 03:57:22 +00:00
|
|
|
|
2015-08-10 12:43:29 +00:00
|
|
|
(defun html/init-emmet-mode ()
|
|
|
|
(use-package emmet-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2015-08-23 01:47:30 +00:00
|
|
|
:init (spacemacs/add-to-hooks 'emmet-mode '(css-mode-hook
|
|
|
|
html-mode-hook
|
2016-02-02 09:02:37 +00:00
|
|
|
sass-mode-hook
|
|
|
|
scss-mode-hook
|
2015-08-23 01:47:30 +00:00
|
|
|
web-mode-hook))
|
2015-08-10 12:43:29 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2020-09-17 21:06:38 +00:00
|
|
|
(define-key emmet-mode-keymap (kbd "<C-return>") 'spacemacs/emmet-expand)
|
2015-08-10 12:43:29 +00:00
|
|
|
(spacemacs|hide-lighter emmet-mode))))
|
|
|
|
|
|
|
|
(defun html/post-init-evil-matchit ()
|
2015-08-10 19:40:05 +00:00
|
|
|
(add-hook 'web-mode-hook 'turn-on-evil-matchit-mode))
|
2015-08-10 12:43:29 +00:00
|
|
|
|
|
|
|
(defun html/post-init-flycheck ()
|
2016-01-27 20:08:25 +00:00
|
|
|
(dolist (mode '(haml-mode
|
|
|
|
less-mode
|
2016-09-11 02:47:43 +00:00
|
|
|
pug-mode
|
2016-01-27 20:08:25 +00:00
|
|
|
sass-mode
|
|
|
|
scss-mode
|
|
|
|
slim-mode
|
|
|
|
web-mode))
|
2017-02-14 03:27:29 +00:00
|
|
|
(spacemacs/enable-flycheck mode)))
|
2015-08-10 12:43:29 +00:00
|
|
|
|
|
|
|
(defun html/init-haml-mode ()
|
|
|
|
(use-package haml-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t))
|
2015-08-10 12:43:29 +00:00
|
|
|
|
2017-08-27 10:28:56 +00:00
|
|
|
(defun html/init-counsel-css ()
|
|
|
|
(use-package counsel-css
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2018-01-07 02:38:13 +00:00
|
|
|
:init (cl-loop for (mode . mode-hook) in '((css-mode . css-mode-hook)
|
2019-10-06 03:29:43 +00:00
|
|
|
(scss-mode . scss-mode-hook))
|
|
|
|
do (add-hook mode-hook 'counsel-css-imenu-setup)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode "gh" 'counsel-css))))
|
2017-08-27 10:28:56 +00:00
|
|
|
|
2016-05-30 02:39:21 +00:00
|
|
|
(defun html/init-helm-css-scss ()
|
|
|
|
(use-package helm-css-scss
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-05-30 02:39:21 +00:00
|
|
|
:init
|
|
|
|
(dolist (mode '(css-mode scss-mode))
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode "gh" 'helm-css-scss))))
|
2014-12-16 03:23:55 +00:00
|
|
|
|
2015-08-27 11:21:24 +00:00
|
|
|
(defun html/init-impatient-mode ()
|
|
|
|
(use-package impatient-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2015-08-27 11:21:24 +00:00
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(dolist (mode '(web-mode css-mode))
|
2018-06-05 05:57:25 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'web-mode "I" 'spacemacs/impatient-mode)))))
|
2015-08-27 11:21:24 +00:00
|
|
|
|
2015-08-10 12:43:29 +00:00
|
|
|
(defun html/init-less-css-mode ()
|
|
|
|
(use-package less-css-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2019-05-08 13:06:17 +00:00
|
|
|
:init
|
|
|
|
(when less-enable-lsp
|
|
|
|
(add-hook 'less-css-mode-hook
|
2019-10-06 03:29:43 +00:00
|
|
|
#'spacemacs//setup-lsp-for-web-mode-buffers t))
|
2015-08-10 12:43:29 +00:00
|
|
|
:mode ("\\.less\\'" . less-css-mode)))
|
|
|
|
|
2018-06-19 06:25:33 +00:00
|
|
|
(defun html/pre-init-prettier-js ()
|
2019-05-12 14:01:05 +00:00
|
|
|
(when (eq web-fmt-tool 'prettier)
|
2019-06-04 19:39:32 +00:00
|
|
|
(dolist (mode '(css-mode less-css-mode scss-mode web-mode))
|
2019-05-12 14:01:05 +00:00
|
|
|
(add-to-list 'spacemacs--prettier-modes mode))))
|
2018-06-19 06:25:33 +00:00
|
|
|
|
2016-09-11 02:47:43 +00:00
|
|
|
(defun html/init-pug-mode ()
|
|
|
|
(use-package pug-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2017-01-02 05:39:04 +00:00
|
|
|
:mode ("\\.pug$" . pug-mode)))
|
2016-09-11 02:47:43 +00:00
|
|
|
|
2015-08-10 12:43:29 +00:00
|
|
|
(defun html/init-sass-mode ()
|
|
|
|
(use-package sass-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2015-08-10 12:43:29 +00:00
|
|
|
:mode ("\\.sass\\'" . sass-mode)))
|
|
|
|
|
|
|
|
(defun html/init-scss-mode ()
|
|
|
|
(use-package scss-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2019-05-08 13:06:17 +00:00
|
|
|
:init
|
|
|
|
(when scss-enable-lsp
|
2019-10-06 03:29:43 +00:00
|
|
|
(add-hook 'scss-mode-hook #'spacemacs//setup-lsp-for-web-mode-buffers t))
|
2015-08-10 12:43:29 +00:00
|
|
|
:mode ("\\.scss\\'" . scss-mode)))
|
|
|
|
|
|
|
|
(defun html/init-slim-mode ()
|
|
|
|
(use-package slim-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t))
|
2015-08-10 12:43:29 +00:00
|
|
|
|
2018-03-04 04:37:53 +00:00
|
|
|
(defun html/post-init-smartparens ()
|
|
|
|
(spacemacs/add-to-hooks
|
2021-03-16 17:47:15 +00:00
|
|
|
#'spacemacs//activate-smartparens
|
2018-03-04 04:37:53 +00:00
|
|
|
'(css-mode-hook scss-mode-hook sass-mode-hook less-css-mode-hook))
|
2021-03-16 17:47:15 +00:00
|
|
|
(add-hook 'web-mode-hook #'spacemacs//deactivate-smartparens))
|
2015-09-13 06:53:34 +00:00
|
|
|
|
2015-08-10 12:43:29 +00:00
|
|
|
(defun html/init-tagedit ()
|
|
|
|
(use-package tagedit
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2015-08-10 12:43:29 +00:00
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(tagedit-add-experimental-features)
|
|
|
|
(add-hook 'html-mode-hook (lambda () (tagedit-mode 1)))
|
|
|
|
(spacemacs|diminish tagedit-mode " Ⓣ" " T"))))
|
|
|
|
|
2014-12-16 03:23:55 +00:00
|
|
|
(defun html/init-web-mode ()
|
|
|
|
(use-package web-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2019-12-07 22:40:48 +00:00
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(spacemacs//web-setup-transient-state)
|
|
|
|
(when html-enable-lsp
|
|
|
|
(add-hook 'web-mode-hook #'spacemacs//setup-lsp-for-html-buffer t)))
|
2015-03-02 20:52:30 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2019-03-30 05:15:16 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'web-mode "m=" "format")
|
2018-03-03 21:44:16 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'web-mode "mE" "errors")
|
2016-08-12 14:57:34 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'web-mode "mg" "goto")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'web-mode "mh" "dom")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'web-mode "mr" "refactor")
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'web-mode
|
2018-03-03 21:44:16 +00:00
|
|
|
"El" 'web-mode-dom-errors-show
|
2015-11-18 00:38:05 +00:00
|
|
|
"gb" 'web-mode-element-beginning
|
|
|
|
"gc" 'web-mode-element-child
|
|
|
|
"gp" 'web-mode-element-parent
|
|
|
|
"gs" 'web-mode-element-sibling-next
|
|
|
|
"hp" 'web-mode-dom-xpath
|
|
|
|
"rc" 'web-mode-element-clone
|
|
|
|
"rd" 'web-mode-element-vanish
|
|
|
|
"rk" 'web-mode-element-kill
|
|
|
|
"rr" 'web-mode-element-rename
|
|
|
|
"rw" 'web-mode-element-wrap
|
2021-03-16 17:47:15 +00:00
|
|
|
"z" 'web-mode-fold-or-unfold))
|
|
|
|
;; TODO element close would be nice but broken with evil.
|
|
|
|
|
2015-03-07 04:47:22 +00:00
|
|
|
:mode
|
|
|
|
(("\\.phtml\\'" . web-mode)
|
|
|
|
("\\.tpl\\.php\\'" . web-mode)
|
2015-08-18 16:13:32 +00:00
|
|
|
("\\.twig\\'" . web-mode)
|
2017-11-16 20:14:40 +00:00
|
|
|
("\\.xml\\'" . web-mode)
|
2015-03-07 04:47:22 +00:00
|
|
|
("\\.html\\'" . web-mode)
|
|
|
|
("\\.htm\\'" . web-mode)
|
|
|
|
("\\.[gj]sp\\'" . web-mode)
|
2015-08-30 11:20:26 +00:00
|
|
|
("\\.as[cp]x?\\'" . web-mode)
|
2015-07-06 14:27:47 +00:00
|
|
|
("\\.eex\\'" . web-mode)
|
2015-03-07 04:47:22 +00:00
|
|
|
("\\.erb\\'" . web-mode)
|
|
|
|
("\\.mustache\\'" . web-mode)
|
|
|
|
("\\.handlebars\\'" . web-mode)
|
|
|
|
("\\.hbs\\'" . web-mode)
|
2015-04-18 21:09:45 +00:00
|
|
|
("\\.eco\\'" . web-mode)
|
2015-07-05 20:20:07 +00:00
|
|
|
("\\.ejs\\'" . web-mode)
|
2019-09-23 10:01:41 +00:00
|
|
|
("\\.svelte\\'" . web-mode)
|
2020-07-03 19:07:41 +00:00
|
|
|
("\\.ctp\\'" . web-mode)
|
2019-12-07 22:40:48 +00:00
|
|
|
("\\.djhtml\\'" . web-mode))))
|
2014-12-16 03:23:55 +00:00
|
|
|
|
2015-08-10 12:43:29 +00:00
|
|
|
(defun html/post-init-yasnippet ()
|
2015-08-23 01:47:30 +00:00
|
|
|
(spacemacs/add-to-hooks 'spacemacs/load-yasnippet '(css-mode-hook
|
|
|
|
jade-mode
|
|
|
|
slim-mode)))
|
2018-05-19 05:53:33 +00:00
|
|
|
(defun html/pre-init-web-beautify ()
|
2019-05-12 14:01:05 +00:00
|
|
|
(when (eq web-fmt-tool 'web-beautify)
|
2019-06-04 19:39:32 +00:00
|
|
|
(add-to-list 'spacemacs--web-beautify-modes (cons 'css-mode 'web-beautify-css))
|
|
|
|
(add-to-list 'spacemacs--web-beautify-modes (cons 'web-mode 'web-beautify-html))))
|