2015-08-01 14:58:51 +00:00
|
|
|
;;; packages.el --- HTML Layer packages File for Spacemacs
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
2018-01-04 07:00:25 +00:00
|
|
|
;; Copyright (c) 2012-2018 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.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
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
|
2017-08-27 10:28:56 +00:00
|
|
|
(counsel-css :requires ivy
|
|
|
|
:location (recipe :fetcher github :repo "hlissner/emacs-counsel-css"))
|
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
|
|
|
|
pug-mode
|
|
|
|
sass-mode
|
|
|
|
scss-mode
|
|
|
|
slim-mode
|
|
|
|
smartparens
|
|
|
|
tagedit
|
|
|
|
web-mode
|
|
|
|
yasnippet
|
|
|
|
))
|
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 ()
|
2017-01-02 05:39:04 +00:00
|
|
|
(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)
|
|
|
|
:modes web-mode
|
|
|
|
:variables
|
|
|
|
;; see https://github.com/osv/company-web/issues/4
|
|
|
|
company-minimum-prefix-length 0)
|
|
|
|
(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)
|
|
|
|
|
2015-11-28 12:17:02 +00:00
|
|
|
;; Explicitly run prog-mode hooks since css-mode does not derive from
|
2016-10-17 12:38:50 +00:00
|
|
|
;; prog-mode major-mode in Emacs 24 and below.
|
|
|
|
(when (version< emacs-version "25")
|
|
|
|
(add-hook 'css-mode-hook 'spacemacs/run-prog-mode-hooks))
|
2015-11-28 12:17:02 +00:00
|
|
|
|
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
|
|
|
|
"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
|
2016-07-26 11:10:45 +00:00
|
|
|
(evil-define-key 'insert emmet-mode-keymap (kbd "TAB") 'spacemacs/emmet-expand)
|
|
|
|
(evil-define-key 'insert emmet-mode-keymap (kbd "<tab>") 'spacemacs/emmet-expand)
|
|
|
|
(evil-define-key 'emacs emmet-mode-keymap (kbd "TAB") 'spacemacs/emmet-expand)
|
|
|
|
(evil-define-key 'emacs emmet-mode-keymap (kbd "<tab>") 'spacemacs/emmet-expand)
|
|
|
|
(evil-define-key 'hybrid emmet-mode-keymap (kbd "TAB") 'spacemacs/emmet-expand)
|
|
|
|
(evil-define-key 'hybrid emmet-mode-keymap (kbd "<tab>") '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)
|
|
|
|
(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))
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'web-mode "i" 'spacemacs/impatient-mode)))))
|
|
|
|
|
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
|
2015-08-10 12:43:29 +00:00
|
|
|
:mode ("\\.less\\'" . less-css-mode)))
|
|
|
|
|
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
|
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
|
|
|
|
(if dotspacemacs-smartparens-strict-mode
|
|
|
|
'smartparens-strict-mode
|
|
|
|
'smartparens-mode)
|
|
|
|
'(css-mode-hook scss-mode-hook sass-mode-hook less-css-mode-hook))
|
2015-09-25 09:01:35 +00:00
|
|
|
|
2016-01-21 15:49:08 +00:00
|
|
|
(add-hook 'web-mode-hook 'spacemacs/toggle-smartparens-off))
|
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
|
2015-03-02 20:52:30 +00:00
|
|
|
:config
|
|
|
|
(progn
|
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
|
|
|
|
"z" 'web-mode-fold-or-unfold
|
2015-03-02 20:52:30 +00:00
|
|
|
;; TODO element close would be nice but broken with evil.
|
|
|
|
)
|
|
|
|
|
2016-01-14 21:18:13 +00:00
|
|
|
;; (defvar spacemacs--web-mode-ms-doc-toggle 0
|
|
|
|
;; "Display a short doc when nil, full doc otherwise.")
|
2015-03-07 04:47:22 +00:00
|
|
|
|
2016-01-14 21:18:13 +00:00
|
|
|
;; (defun spacemacs//web-mode-ms-doc ()
|
|
|
|
;; (if (equal 0 spacemacs--web-mode-ms-doc-toggle)
|
|
|
|
;; "[_?_] for help"
|
|
|
|
;; "
|
|
|
|
;; [_?_] display this help
|
|
|
|
;; [_k_] previous [_j_] next [_K_] previous sibling [_J_] next sibling
|
|
|
|
;; [_h_] parent [_l_] child [_c_] clone [_d_] delete [_D_] kill [_r_] rename
|
|
|
|
;; [_w_] wrap [_p_] xpath
|
|
|
|
;; [_q_] quit"))
|
2015-03-07 04:47:22 +00:00
|
|
|
|
2016-01-14 21:18:13 +00:00
|
|
|
;; (defun spacemacs//web-mode-ms-toggle-doc ()
|
|
|
|
;; (interactive)
|
|
|
|
;; (setq spacemacs--web-mode-ms-doc-toggle
|
|
|
|
;; (logxor spacemacs--web-mode-ms-doc-toggle 1)))
|
2015-03-07 04:47:22 +00:00
|
|
|
|
2016-01-20 02:55:38 +00:00
|
|
|
(spacemacs|define-transient-state web-mode
|
|
|
|
:title "Web-mode Transient State"
|
2016-01-14 21:18:13 +00:00
|
|
|
:columns 4
|
|
|
|
:foreign-keys run
|
2016-06-18 03:40:06 +00:00
|
|
|
:evil-leader-for-mode (web-mode . ".")
|
2015-03-02 20:52:30 +00:00
|
|
|
:bindings
|
2016-01-14 21:18:13 +00:00
|
|
|
("j" web-mode-element-next "next")
|
|
|
|
("J" web-mode-element-sibling-next "next sibling")
|
2015-08-29 07:11:09 +00:00
|
|
|
("gj" web-mode-element-sibling-next)
|
2016-01-14 21:18:13 +00:00
|
|
|
("k" web-mode-element-previous "previous")
|
|
|
|
("K" web-mode-element-sibling-previous "previous sibling")
|
2015-08-29 07:11:09 +00:00
|
|
|
("gk" web-mode-element-sibling-previous)
|
2016-01-14 21:18:13 +00:00
|
|
|
("h" web-mode-element-parent "parent")
|
|
|
|
("l" web-mode-element-child "child")
|
|
|
|
("c" web-mode-element-clone "clone")
|
|
|
|
("d" web-mode-element-vanish "delete")
|
|
|
|
("D" web-mode-element-kill "kill")
|
|
|
|
("r" web-mode-element-rename "rename" :exit t)
|
|
|
|
("w" web-mode-element-wrap "wrap")
|
|
|
|
("p" web-mode-dom-xpath "xpath")
|
|
|
|
("q" nil "quit" :exit t)
|
2016-06-18 03:40:06 +00:00
|
|
|
("<escape>" nil nil :exit t)))
|
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)
|
2015-03-07 04:47:22 +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)))
|