This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/contrib/lang/html/packages.el

154 lines
4.3 KiB
EmacsLisp
Raw Normal View History

;;; 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
(defvar html-packages
'(
emmet-mode
evil-matchit
flycheck
helm-css-scss
less-css-mode
scss-mode
tagedit
web-mode
yasnippet
haml-mode
slim-mode
)
"List of all packages to install and/or initialize. Built-in packages
which require an initialization must be listed explicitly in the list.")
(defun html/init-helm-css-scss ()
(use-package helm-css-scss
:defer t
:init
(eval-after-load 'scss-mode
'(evil-leader/set-key-for-mode 'scss-mode "mgh" 'helm-css-scss))))
(defun html/init-web-mode ()
(use-package web-mode
:defer t
2015-03-02 20:52:30 +00:00
:config
(progn
(evil-leader/set-key-for-mode 'web-mode
"meh" 'web-mode-dom-errors-show
2015-03-02 20:52:30 +00:00
"mgb" 'web-mode-element-beginning
"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
"mrc" 'web-mode-element-clone
2015-03-02 20:52:30 +00:00
"mrd" 'web-mode-element-vanish
"mrr" 'web-mode-element-rename
2015-03-02 20:52:30 +00:00
"mrw" 'web-mode-element-wrap
"mz" 'web-mode-fold-or-unfold
2015-03-02 20:52:30 +00:00
;; TODO element close would be nice but broken with evil.
)
(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
[h] previous [l] next [L] sibling [k] parent [j] child
[c] clone [d] delete [r] rename [w] wrap [p] xpath
[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
:doc (spacemacs//web-mode-ms-doc)
2015-03-02 20:52:30 +00:00
:persistent t
:evil-leader-for-mode (web-mode . "m.")
2015-03-02 20:52:30 +00:00
:bindings
("<escape>" nil :exit t)
("?" spacemacs//web-mode-ms-toggle-doc)
("c" web-mode-element-clone)
("d" web-mode-element-vanish)
2015-03-02 20:52:30 +00:00
("h" web-mode-element-previous)
("l" web-mode-element-next)
("L" web-mode-element-sibling-next)
("k" web-mode-element-parent)
("j" web-mode-element-child)
("p" web-mode-dom-xpath)
("r" web-mode-element-rename)
("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)
("\\.djhtml\\'" . web-mode))))
(defun html/init-emmet-mode ()
(use-package emmet-mode
:defer t
2014-12-19 20:37:31 +00:00
:init
(progn
(add-hook 'web-mode-hook 'emmet-mode)
(add-hook 'html-mode-hook 'emmet-mode)
(add-hook 'css-mode-hook 'emmet-mode))
:config
(progn
2014-12-19 20:37:31 +00:00
(local-set-key (kbd "<tab>") 'emmet-expand-yas)
(spacemacs|hide-lighter emmet-mode))))
(defun html/init-evil-matchit ()
(add-hook 'web-mode-hook 'evil-matchit-mode))
(defun html/init-scss-mode ()
(use-package scss-mode
:defer t
:mode ("\\.scss\\'" . scss-mode)))
(defun html/init-flycheck ()
(add-hook 'web-mode-hook 'flycheck-mode)
(add-hook 'scss-mode-hook 'flycheck-mode))
(defun html/init-tagedit ()
(use-package tagedit
:defer t
:config
(progn
(tagedit-add-experimental-features)
(add-hook 'html-mode-hook (lambda () (tagedit-mode 1)))
(spacemacs|diminish tagedit-mode "" " T"))))
(defun html/init-yasnippet ()
(use-package yasnippet
:defer t
:init
(add-hook 'css-mode-hook 'spacemacs/load-yasnippet)))
(defun html/init-haml-mode ()
(use-package haml-mode
:defer t))
(defun html/init-slim-mode ()
(use-package slim-mode
:defer t))