doomemacs/modules/lang/web/+css.el
Henrik Lissner 5c06edd90a
lang/web: fix comments not joining/filling correctly
Before, joining these two lines

  // hello
  // world

Results in

  // hello // world

And filling the following

  // Pretend this line is longer than 80 characters

Becomes

  // Pretend this lineis longer than
  80 characters
2020-11-09 17:19:14 -05:00

77 lines
2.3 KiB
EmacsLisp

;;; lang/web/+css.el -*- lexical-binding: t; -*-
(defvar +web-continue-block-comments t
"If non-nil, newlines in block comments are continued with a leading *.
This also indirectly means the asterisks in the opening /* and closing */ will
be aligned.
If set to `nil', disable all the above behaviors.")
(after! projectile
(pushnew! projectile-other-file-alist
'("css" "scss" "sass" "less" "styl")
'("scss" "css")
'("sass" "css")
'("less" "css")
'("styl" "css")))
;;
;;; Major modes
(setq-hook! 'css-mode-hook
;; Correctly continue /* and // comments on newline-and-indent
comment-line-break-function #'+css/comment-indent-new-line
;; Fix `fill-paragraph' not conjoining line comments in CSS modes correctly.
adaptive-fill-function #'+css-adaptive-fill-fn)
(after! (:any css-mode sass-mode)
(set-docsets! '(css-mode scss-mode sass-mode)
"CSS" "HTML" "Bourbon" "Compass"
["Sass" (memq major-mode '(scss-mode sass-mode))]))
(add-hook! '(css-mode-hook sass-mode-hook stylus-mode-hook)
#'rainbow-mode)
;; built-in. Contains both css-mode & scss-mode
(after! css-mode
;; css-mode hooks apply to scss and less-css modes
(map! :localleader
:map scss-mode-map
"b" #'+css/scss-build
:map (css-mode-map scss-mode-map less-css-mode-map)
"rb" #'+css/toggle-inline-or-block)
(use-package! counsel-css
:when (featurep! :completion ivy)
:hook (css-mode . counsel-css-imenu-setup)
:init
(map! :map (css-mode-map scss-mode-map less-css-mode-map)
:localleader ";" #'counsel-css))
(use-package! helm-css-scss
:when (featurep! :completion helm)
:defer t
:init
(map! :map (css-mode-map scss-mode-map less-css-mode-map)
:localleader ";" #'helm-css-scss)
:config
(setq helm-css-scss-split-direction #'split-window-vertically
helm-css-scss-split-with-multiple-windows t)))
(after! sass-mode
(set-company-backend! 'sass-mode 'company-css)
(map! :map sass-mode-map :localleader "b" #'+css/sass-build))
;;
;;; Tools
(when (featurep! +lsp)
(add-hook! '(css-mode-local-vars-hook
scss-mode-local-vars-hook
sass-mode-local-vars-hook
less-css-mode-local-vars-hook)
#'lsp!))