<commit_before>;;; lang/web/+css.el -*- lexical-binding: t; -*-

;; css-mode hooks apply to scss and less-css modes
(add-hook 'css-mode-hook #'rainbow-delimiters-mode)
(add-hook! (css-mode sass-mode)
  #'(yas-minor-mode-on flycheck-mode highlight-numbers-mode))

;; An improved newline+continue comment function
(add-hook! css-mode (setq-local comment-indent-function #'+css/comment-indent-new-line))

(after! smartparens
  (sp-with-modes '(css-mode scss-mode less-css-mode stylus-mode)
    (sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))))

(map! :map* (css-mode-map scss-mode-map less-css-mode-map)
      :n "M-R" #'+css/web-refresh-browser
      (:localleader
        :n "rb" #'+css/toggle-inline-or-block))


;;
;; Packages
;;

(def-package! counsel-css
  :when (featurep! :completion ivy)
  :commands (counsel-css counsel-css-imenu-setup)
  :hook (css-mode . counsel-css-imenu-setup)
  :init
  (map! :map* (css-mode-map scss-mode-map less-css-mode-map)
        :localleader :n ";" #'counsel-css))


(def-package! rainbow-mode
  :hook (css-mode sass-mode))


(def-package! css-mode
  :mode "\\.css$"
  :mode ("\\.scss$" . scss-mode)
  :config
  (set! :company-backend '(css-mode scss-mode) 'company-css)
  (map! :map scss-mode-map :localleader :n "b" #'+css/scss-build))


(def-package! sass-mode
  :mode "\\.sass$"
  :config
  (set! :company-backend 'sass-mode 'company-css)<commit_msg>lang/web: register docsets for css, scss & sass<commit_after>;;; lang/web/+css.el -*- lexical-binding: t; -*-

;; css-mode hooks apply to scss and less-css modes
(add-hook 'css-mode-hook #'rainbow-delimiters-mode)
(add-hook! (css-mode sass-mode)
  #'(yas-minor-mode-on flycheck-mode highlight-numbers-mode))

;; An improved newline+continue comment function
(add-hook! css-mode (setq-local comment-indent-function #'+css/comment-indent-new-line))

(after! smartparens
  (sp-with-modes '(css-mode scss-mode less-css-mode stylus-mode)
    (sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))))

(map! :map* (css-mode-map scss-mode-map less-css-mode-map)
      :n "M-R" #'+css/web-refresh-browser
      (:localleader
        :n "rb" #'+css/toggle-inline-or-block))


;;
;; Packages
;;

(def-package! counsel-css
  :when (featurep! :completion ivy)
  :commands (counsel-css counsel-css-imenu-setup)
  :hook (css-mode . counsel-css-imenu-setup)
  :init
  (map! :map* (css-mode-map scss-mode-map less-css-mode-map)
        :localleader :n ";" #'counsel-css))


(def-package! rainbow-mode
  :hook (css-mode sass-mode))


(def-package! css-mode
  :mode "\\.css$"
  :mode ("\\.scss$" . scss-mode)
  :config
  (set! :docset 'css-mode "CSS")
  (set! :docset 'scss-mode "Sass")
  (set! :company-backend '(css-mode scss-mode) 'company-css)
  (map! :map scss-mode-map :localleader :n "b" #'+css/scss-build))


(def-package! sass-mode
  :mode "\\.sass$"
  :config
  (set! :docset 'sass-mode "Sass")
  (set! :company-backend 'sass-mode 'company-css)
{'fraction_non_alphanumeric': 0.20719811638076016, 'fraction_numerical': 0.0, 'mean_word_length': 3.561349693251534, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7214895', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1186, 'n_words': 239}