2015-01-14 04:12:56 +00:00
|
|
|
;;; packages.el --- HTTP Layer packages File for Spacemacs
|
|
|
|
;;
|
|
|
|
;; Copyright (c) 2012-2014 Sylvain Benner
|
|
|
|
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
|
|
|
|
;;
|
|
|
|
;; 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
|
2014-12-16 03:23:55 +00:00
|
|
|
'(
|
2015-04-09 03:57:22 +00:00
|
|
|
company
|
2015-05-06 19:10:36 +00:00
|
|
|
company-web
|
2015-04-09 03:57:22 +00:00
|
|
|
css-mode
|
2014-12-16 03:23:55 +00:00
|
|
|
emmet-mode
|
2015-01-16 04:45:53 +00:00
|
|
|
evil-matchit
|
2014-12-16 03:23:55 +00:00
|
|
|
flycheck
|
|
|
|
helm-css-scss
|
|
|
|
less-css-mode
|
|
|
|
scss-mode
|
2015-03-17 22:15:58 +00:00
|
|
|
sass-mode
|
2014-12-16 03:23:55 +00:00
|
|
|
tagedit
|
|
|
|
web-mode
|
2015-02-10 18:39:58 +00:00
|
|
|
yasnippet
|
2015-02-26 00:09:06 +00:00
|
|
|
haml-mode
|
|
|
|
slim-mode
|
2015-04-19 03:40:24 +00:00
|
|
|
))
|
2014-12-16 03:23:55 +00:00
|
|
|
|
2015-04-09 03:57:22 +00:00
|
|
|
(defun html/init-css-mode ()
|
|
|
|
(use-package css-mode
|
|
|
|
:defer t
|
|
|
|
:init
|
2015-04-30 03:54:30 +00:00
|
|
|
(push 'company-css company-backends-css-mode)))
|
2015-04-09 03:57:22 +00:00
|
|
|
|
2014-12-16 03:23:55 +00:00
|
|
|
(defun html/init-helm-css-scss ()
|
|
|
|
(use-package helm-css-scss
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(eval-after-load 'scss-mode
|
2015-01-21 03:32:13 +00:00
|
|
|
'(evil-leader/set-key-for-mode 'scss-mode "mgh" 'helm-css-scss))))
|
2014-12-16 03:23:55 +00:00
|
|
|
|
|
|
|
(defun html/init-web-mode ()
|
|
|
|
(use-package web-mode
|
|
|
|
:defer t
|
2015-05-06 19:10:36 +00:00
|
|
|
:init
|
|
|
|
(push 'company-web-html company-backends-web-mode)
|
2015-03-02 20:52:30 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2015-04-18 21:09:45 +00:00
|
|
|
;; Only use smartparens in web-mode
|
|
|
|
(setq web-mode-enable-auto-pairing nil)
|
2015-03-02 20:52:30 +00:00
|
|
|
|
2015-04-29 05:59:14 +00:00
|
|
|
(sp-local-pair 'web-mode "<% " " %>")
|
|
|
|
(sp-local-pair 'web-mode "{ " " }")
|
|
|
|
(sp-local-pair 'web-mode "<%= " " %>")
|
|
|
|
(sp-local-pair 'web-mode "<%# " " %>")
|
|
|
|
(sp-local-pair 'web-mode "<%$ " " %>")
|
|
|
|
(sp-local-pair 'web-mode "<%@ " " %>")
|
|
|
|
(sp-local-pair 'web-mode "<%: " " %>")
|
|
|
|
(sp-local-pair 'web-mode "{{ " " }}")
|
|
|
|
(sp-local-pair 'web-mode "{% " " %}")
|
|
|
|
(sp-local-pair 'web-mode "{%- " " %}")
|
|
|
|
(sp-local-pair 'web-mode "{# " " #}")
|
|
|
|
|
|
|
|
|
2015-03-02 20:52:30 +00:00
|
|
|
(evil-leader/set-key-for-mode 'web-mode
|
2015-03-07 04:39:40 +00:00
|
|
|
"meh" 'web-mode-dom-errors-show
|
2015-03-02 20:52:30 +00:00
|
|
|
"mgb" 'web-mode-element-beginning
|
2015-03-07 04:39:40 +00:00
|
|
|
"mgc" 'web-mode-element-child
|
|
|
|
"mgp" 'web-mode-element-parent
|
2015-03-02 20:52:30 +00:00
|
|
|
"mgs" 'web-mode-element-sibling-next
|
|
|
|
"mhp" 'web-mode-dom-xpath
|
2015-03-07 04:39:40 +00:00
|
|
|
"mrc" 'web-mode-element-clone
|
2015-03-02 20:52:30 +00:00
|
|
|
"mrd" 'web-mode-element-vanish
|
2015-03-27 10:45:01 +00:00
|
|
|
"mrk" 'web-mode-element-kill
|
2015-03-07 04:39:40 +00:00
|
|
|
"mrr" 'web-mode-element-rename
|
2015-03-02 20:52:30 +00:00
|
|
|
"mrw" 'web-mode-element-wrap
|
2015-03-07 04:39:40 +00:00
|
|
|
"mz" 'web-mode-fold-or-unfold
|
2015-03-02 20:52:30 +00:00
|
|
|
;; TODO element close would be nice but broken with evil.
|
|
|
|
)
|
|
|
|
|
2015-03-07 04:47:22 +00:00
|
|
|
(defvar spacemacs--web-mode-ms-doc-toggle 0
|
|
|
|
"Display a short doc when nil, full doc otherwise.")
|
|
|
|
|
|
|
|
(defun spacemacs//web-mode-ms-doc ()
|
|
|
|
(if (equal 0 spacemacs--web-mode-ms-doc-toggle)
|
|
|
|
"[?] for help"
|
|
|
|
"
|
|
|
|
[?] display this help
|
2015-03-27 10:45:01 +00:00
|
|
|
[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
|
2015-03-07 04:47:22 +00:00
|
|
|
[q] quit"))
|
|
|
|
|
|
|
|
(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-02 20:52:30 +00:00
|
|
|
(spacemacs|define-micro-state web-mode
|
2015-03-07 04:47:22 +00:00
|
|
|
:doc (spacemacs//web-mode-ms-doc)
|
2015-03-02 20:52:30 +00:00
|
|
|
:persistent t
|
2015-03-07 04:47:22 +00:00
|
|
|
:evil-leader-for-mode (web-mode . "m.")
|
2015-03-02 20:52:30 +00:00
|
|
|
:bindings
|
2015-03-07 04:47:22 +00:00
|
|
|
("<escape>" nil :exit t)
|
|
|
|
("?" spacemacs//web-mode-ms-toggle-doc)
|
|
|
|
("c" web-mode-element-clone)
|
|
|
|
("d" web-mode-element-vanish)
|
2015-03-27 10:45:01 +00:00
|
|
|
("D" web-mode-element-kill)
|
|
|
|
("j" web-mode-element-next)
|
|
|
|
("J" web-mode-element-sibling-next)
|
|
|
|
("k" web-mode-element-previous)
|
|
|
|
("K" web-mode-element-sibling-previous)
|
|
|
|
("h" web-mode-element-parent)
|
|
|
|
("l" web-mode-element-child)
|
2015-03-02 20:52:30 +00:00
|
|
|
("p" web-mode-dom-xpath)
|
|
|
|
("r" web-mode-element-rename)
|
2015-03-07 04:47:22 +00:00
|
|
|
("q" nil :exit t)
|
|
|
|
("w" web-mode-element-wrap)))
|
|
|
|
|
|
|
|
:mode
|
|
|
|
(("\\.phtml\\'" . web-mode)
|
|
|
|
("\\.tpl\\.php\\'" . web-mode)
|
|
|
|
("\\.html\\'" . web-mode)
|
|
|
|
("\\.htm\\'" . web-mode)
|
|
|
|
("\\.[gj]sp\\'" . web-mode)
|
|
|
|
("\\.as[cp]x\\'" . web-mode)
|
|
|
|
("\\.erb\\'" . web-mode)
|
|
|
|
("\\.mustache\\'" . web-mode)
|
|
|
|
("\\.handlebars\\'" . web-mode)
|
|
|
|
("\\.hbs\\'" . web-mode)
|
2015-04-18 21:09:45 +00:00
|
|
|
("\\.eco\\'" . web-mode)
|
2015-03-07 04:47:22 +00:00
|
|
|
("\\.djhtml\\'" . web-mode))))
|
2014-12-16 03:23:55 +00:00
|
|
|
|
|
|
|
(defun html/init-emmet-mode ()
|
|
|
|
(use-package emmet-mode
|
|
|
|
:defer t
|
2014-12-19 20:37:31 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2014-12-16 03:23:55 +00:00
|
|
|
(add-hook 'web-mode-hook 'emmet-mode)
|
|
|
|
(add-hook 'html-mode-hook 'emmet-mode)
|
|
|
|
(add-hook 'css-mode-hook 'emmet-mode))
|
|
|
|
:config
|
|
|
|
(progn
|
2015-04-19 17:52:16 +00:00
|
|
|
(evil-define-key 'insert emmet-mode-keymap (kbd "TAB") 'emmet-expand-yas)
|
2015-04-18 11:37:36 +00:00
|
|
|
(evil-define-key 'insert emmet-mode-keymap (kbd "<tab>") 'emmet-expand-yas)
|
2015-04-19 17:52:16 +00:00
|
|
|
(evil-define-key 'emacs emmet-mode-keymap (kbd "TAB") 'emmet-expand-yas)
|
2015-04-18 21:09:45 +00:00
|
|
|
(evil-define-key 'emacs emmet-mode-keymap (kbd "<tab>") 'emmet-expand-yas)
|
2014-12-16 03:23:55 +00:00
|
|
|
(spacemacs|hide-lighter emmet-mode))))
|
|
|
|
|
2015-04-04 05:41:34 +00:00
|
|
|
(defun html/post-init-evil-matchit ()
|
2015-01-16 04:45:53 +00:00
|
|
|
(add-hook 'web-mode-hook 'evil-matchit-mode))
|
|
|
|
|
2014-12-16 03:23:55 +00:00
|
|
|
(defun html/init-scss-mode ()
|
|
|
|
(use-package scss-mode
|
|
|
|
:defer t
|
|
|
|
:mode ("\\.scss\\'" . scss-mode)))
|
|
|
|
|
2015-03-17 22:15:58 +00:00
|
|
|
(defun html/init-sass-mode ()
|
|
|
|
(use-package sass-mode
|
|
|
|
:defer t
|
|
|
|
:mode ("\\.sass\\'" . sass-mode)))
|
|
|
|
|
2015-03-30 16:20:13 +00:00
|
|
|
(defun html/init-less-css-mode ()
|
|
|
|
(use-package less-css-mode
|
|
|
|
:defer t
|
|
|
|
:mode ("\\.less\\'" . less-css-mode)))
|
|
|
|
|
2015-04-11 02:23:16 +00:00
|
|
|
(defun html/post-init-flycheck ()
|
2014-12-16 03:23:55 +00:00
|
|
|
(add-hook 'web-mode-hook 'flycheck-mode)
|
2015-03-17 22:15:58 +00:00
|
|
|
(add-hook 'scss-mode-hook 'flycheck-mode)
|
|
|
|
(add-hook 'sass-mode-hook 'flycheck-mode))
|
2014-12-16 03:23:55 +00:00
|
|
|
|
|
|
|
(defun html/init-tagedit ()
|
|
|
|
(use-package tagedit
|
|
|
|
:defer t
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(tagedit-add-experimental-features)
|
|
|
|
(add-hook 'html-mode-hook (lambda () (tagedit-mode 1)))
|
2014-12-23 21:39:57 +00:00
|
|
|
(spacemacs|diminish tagedit-mode " Ⓣ" " T"))))
|
2015-02-10 18:39:58 +00:00
|
|
|
|
|
|
|
(defun html/init-yasnippet ()
|
|
|
|
(use-package yasnippet
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(add-hook 'css-mode-hook 'spacemacs/load-yasnippet)))
|
2015-02-26 00:09:06 +00:00
|
|
|
|
|
|
|
(defun html/init-haml-mode ()
|
|
|
|
(use-package haml-mode
|
|
|
|
:defer t))
|
|
|
|
|
|
|
|
(defun html/init-slim-mode ()
|
|
|
|
(use-package slim-mode
|
|
|
|
:defer t))
|
2015-04-07 20:02:53 +00:00
|
|
|
|
|
|
|
(when (configuration-layer/layer-usedp 'auto-completion)
|
2015-04-09 03:57:22 +00:00
|
|
|
(defun html/post-init-company ()
|
2015-05-06 19:10:36 +00:00
|
|
|
(spacemacs|add-company-hook css-mode)
|
2015-05-07 02:16:18 +00:00
|
|
|
(spacemacs|add-company-hook web-mode))
|
|
|
|
|
|
|
|
(defun html/init-company-web ()
|
|
|
|
(use-package company-web)))
|