<commit_before>;;; packages.el --- HTTP Layer packages File for Spacemacs
;;
;; Copyright (c) 2012-2014 <NAME>
;; Copyright (c) 2014-2015 <NAME> & Contributors
;;
;; Author: <NAME> <<EMAIL>>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3

(setq html-packages
  '(
    company
    company-web
    css-mode
    emmet-mode
    evil-matchit
    flycheck
    helm-css-scss
    less-css-mode
    rainbow-delimiters
    scss-mode
    sass-mode
    tagedit
    web-mode
    yasnippet
    haml-mode
    slim-mode
    jade-mode
    ))

(defun html/init-css-mode ()
  (use-package css-mode
    :defer t
    :init
    (push 'company-css company-backends-css-mode)))

(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
    :init
    (push 'company-web-html company-backends-web-mode)
    :config
    (progn
      ;; Only use smartparens in web-mode
      (setq web-mode-enable-auto-pairing nil)

      (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 "{# "  " #}")

      (evil-leader/set-key-for-mode 'web-mode
        "meh" 'web-mode-dom-errors-show
        "mgb" 'web-mode-element-beginning
        "mgc" 'web-mode-element-child
        "mgp" 'web-mode-element-parent
        "mgs" 'web-mode-element-sibling-next
        "mhp" 'web-mode-dom-xpath
        "mrc" 'web-mode-element-clone
        "mrd" 'web-mode-element-vanish
        "mrk" 'web-mode-element-kill
        "mrr" 'web-mode-element-rename
        "mrw" 'web-mode-element-wrap
        "mz" 'web-mode-fold-or-unfold
        ;; 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
  [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"))

      (defun spacemacs//web-mode-ms-toggle-doc ()
        (interactive)
        (setq spacemacs--web-mode-ms-doc-toggle
              (logxor spacemacs--web-mode-ms-doc-toggle 1)))

      (spacemacs|define-micro-state web-mode
        :doc (spacemacs//web-mode-ms-doc)
        :persistent t
        :evil-leader-for-mode (web-mode . "m.")
        :bindings
        ("<escape>" nil :exit t)
        ("?" spacemacs//web-mode-ms-toggle-doc)
        ("c" web-mode-element-clone)
        ("d" web-mode-element-vanish)
        ("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)
        ("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)
     ("\\.eex\\'"        . web-mode)
     ("\\.erb\\'"        . web-mode)
     ("\\.mustache\\'"   . web-mode)
     ("\\.handlebars\\'" . web-mode)
     ("\\.hbs\\'"        . web-mode)
     ("\\.eco\\'"        . web-mode)
     ("\\.jsx\\'"        . web-mode)
     ("\\.djhtml\\'"     . web-mode))))

(defun html/init-emmet-mode ()
  (use-package emmet-mode
    :defer t
    :init (add-to-hooks 'emmet-mode '(css-mode-hook
                                      html-mode-hook
                                      web-mode-hook))
    :config
    (progn
      (evil-define-key 'insert emmet-mode-keymap (kbd "TAB") 'emmet-expand-yas)
      (evil-define-key 'insert emmet-mode-keymap (kbd "<tab>") 'emmet-expand-yas)
      (evil-define-key 'emacs emmet-mode-keymap (kbd "TAB") 'emmet-expand-yas)
      (evil-define-key 'emacs emmet-mode-keymap (kbd "<tab>") 'emmet-expand-yas)
      (spacemacs|hide-lighter emmet-mode))))

(defun html/post-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-sass-mode ()
  (use-package sass-mode
    :defer t
    :mode ("\\.sass\\'" . sass-mode)))

(defun html/init-less-css-mode ()
  (use-package less-css-mode
    :defer t
    :mode ("\\.less\\'" . less-css-mode)))

(defun html/post-init-flycheck ()
  (add-to-hooks 'flycheck-mode '(haml-mode-hook
                                 jade-mode-hook
                                 less-mode-hook
                                 sass-mode-hook
                                 scss-mode-hook
                                 slim-mode-hook
                                 web-mode-hook)))

(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-to-hooks 'spacemacs/load-yasnippet '(css-mode-hook
                                              jade-mode
                                              slim-mode))))

(defun html/init-haml-mode ()
  (use-package haml-mode
    :defer t))

(defun html/init-slim-mode ()
  (use-package slim-mode
    :defer t))

(defun html/init-jade-mode ()
  (use-package jade-mode
    :defer t))

(when (configuration-layer/layer-usedp 'auto-completion)
  ;;TODO: whenever company-web makes a backend for haml-mode it should be added here. -- @robbyoconnor
  (defun html/post-init-company ()
    (spacemacs|add-company-hook css-mode)
    (spacemacs|add-company-hook jade-mode)
    (spacemacs|add-company-hook slim-mode)
    (spacemacs|add-company-hook web-mode))

  (defun html/init-company-web ()
    (use-package company-web)))

(defun html/post-init-rainbow-delimiters ()
  (add-to-hooks 'rainbow-delimiters-mode '(haml-mode-hook
                                           jade-mode-hook
                                           less-css-mode-hook
                                           scss-mode-hook
                                           slim-mode-hook)))
<commit_msg>add ejs files to web-mode<commit_after>;;; packages.el --- HTTP Layer packages File for Spacemacs
;;
;; Copyright (c) 2012-2014 <NAME>
;; Copyright (c) 2014-2015 <NAME> & Contributors
;;
;; Author: <NAME> <<EMAIL>>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3

(setq html-packages
  '(
    company
    company-web
    css-mode
    emmet-mode
    evil-matchit
    flycheck
    helm-css-scss
    less-css-mode
    rainbow-delimiters
    scss-mode
    sass-mode
    tagedit
    web-mode
    yasnippet
    haml-mode
    slim-mode
    jade-mode
    ))

(defun html/init-css-mode ()
  (use-package css-mode
    :defer t
    :init
    (push 'company-css company-backends-css-mode)))

(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
    :init
    (push 'company-web-html company-backends-web-mode)
    :config
    (progn
      ;; Only use smartparens in web-mode
      (setq web-mode-enable-auto-pairing nil)

      (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 "{# "  " #}")

      (evil-leader/set-key-for-mode 'web-mode
        "meh" 'web-mode-dom-errors-show
        "mgb" 'web-mode-element-beginning
        "mgc" 'web-mode-element-child
        "mgp" 'web-mode-element-parent
        "mgs" 'web-mode-element-sibling-next
        "mhp" 'web-mode-dom-xpath
        "mrc" 'web-mode-element-clone
        "mrd" 'web-mode-element-vanish
        "mrk" 'web-mode-element-kill
        "mrr" 'web-mode-element-rename
        "mrw" 'web-mode-element-wrap
        "mz" 'web-mode-fold-or-unfold
        ;; 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
  [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"))

      (defun spacemacs//web-mode-ms-toggle-doc ()
        (interactive)
        (setq spacemacs--web-mode-ms-doc-toggle
              (logxor spacemacs--web-mode-ms-doc-toggle 1)))

      (spacemacs|define-micro-state web-mode
        :doc (spacemacs//web-mode-ms-doc)
        :persistent t
        :evil-leader-for-mode (web-mode . "m.")
        :bindings
        ("<escape>" nil :exit t)
        ("?" spacemacs//web-mode-ms-toggle-doc)
        ("c" web-mode-element-clone)
        ("d" web-mode-element-vanish)
        ("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)
        ("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)
     ("\\.eex\\'"        . web-mode)
     ("\\.erb\\'"        . web-mode)
     ("\\.mustache\\'"   . web-mode)
     ("\\.handlebars\\'" . web-mode)
     ("\\.hbs\\'"        . web-mode)
     ("\\.eco\\'"        . web-mode)
     ("\\.jsx\\'"        . web-mode)
     ("\\.ejs\\'"        . web-mode)
     ("\\.djhtml\\'"     . web-mode))))

(defun html/init-emmet-mode ()
  (use-package emmet-mode
    :defer t
    :init (add-to-hooks 'emmet-mode '(css-mode-hook
                                      html-mode-hook
                                      web-mode-hook))
    :config
    (progn
      (evil-define-key 'insert emmet-mode-keymap (kbd "TAB") 'emmet-expand-yas)
      (evil-define-key 'insert emmet-mode-keymap (kbd "<tab>") 'emmet-expand-yas)
      (evil-define-key 'emacs emmet-mode-keymap (kbd "TAB") 'emmet-expand-yas)
      (evil-define-key 'emacs emmet-mode-keymap (kbd "<tab>") 'emmet-expand-yas)
      (spacemacs|hide-lighter emmet-mode))))

(defun html/post-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-sass-mode ()
  (use-package sass-mode
    :defer t
    :mode ("\\.sass\\'" . sass-mode)))

(defun html/init-less-css-mode ()
  (use-package less-css-mode
    :defer t
    :mode ("\\.less\\'" . less-css-mode)))

(defun html/post-init-flycheck ()
  (add-to-hooks 'flycheck-mode '(haml-mode-hook
                                 jade-mode-hook
                                 less-mode-hook
                                 sass-mode-hook
                                 scss-mode-hook
                                 slim-mode-hook
                                 web-mode-hook)))

(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-to-hooks 'spacemacs/load-yasnippet '(css-mode-hook
                                              jade-mode
                                              slim-mode))))

(defun html/init-haml-mode ()
  (use-package haml-mode
    :defer t))

(defun html/init-slim-mode ()
  (use-package slim-mode
    :defer t))

(defun html/init-jade-mode ()
  (use-package jade-mode
    :defer t))

(when (configuration-layer/layer-usedp 'auto-completion)
  ;;TODO: whenever company-web makes a backend for haml-mode it should be added here. -- @robbyoconnor
  (defun html/post-init-company ()
    (spacemacs|add-company-hook css-mode)
    (spacemacs|add-company-hook jade-mode)
    (spacemacs|add-company-hook slim-mode)
    (spacemacs|add-company-hook web-mode))

  (defun html/init-company-web ()
    (use-package company-web)))

(defun html/post-init-rainbow-delimiters ()
  (add-to-hooks 'rainbow-delimiters-mode '(haml-mode-hook
                                           jade-mode-hook
                                           less-css-mode-hook
                                           scss-mode-hook
                                           slim-mode-hook)))

{'fraction_non_alphanumeric': 0.1749100402173146, 'fraction_numerical': 0.003245607845904184, 'mean_word_length': 1.7384080370942814, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 40, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3687991', 'n_tokens_mistral': 5249, 'n_tokens_neox': 5136, 'n_words': 914}