doomemacs/modules/lang/web/+css.el
Henrik Lissner d8b1e469bc
Introduce autodefs to replace some settings
+ :popup -> set-popup-rule!
+ :popups -> set-popup-rules!
+ :company-backend -> set-company-backend!
+ :evil-state -> set-evil-initial-state!

I am slowly phasing out the setting system (def-setting! and set!),
starting with these.

What are autodefs? These are functions that are always defined, whether
or not their respective modules are enabled. However, when their modules
are disabled, they are replaced with macros that no-op and don't
waste time evaluating their arguments.

The old set! function will still work, for a while.
2018-06-15 03:42:01 +02:00

55 lines
1.5 KiB
EmacsLisp

;;; lang/web/+css.el -*- lexical-binding: t; -*-
;; An improved newline+continue comment function
(setq-hook! css-mode 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)
:localleader
:n "rb" #'+css/toggle-inline-or-block)
;;
;; Packages
;;
;; css-mode hooks apply to scss and less-css modes
(add-hook 'css-mode-hook #'rainbow-delimiters-mode)
(add-hook! (css-mode sass-mode stylus-mode)
#'(yas-minor-mode-on
flycheck-mode
highlight-numbers-mode
rainbow-mode))
(def-package! counsel-css
:when (featurep! :completion ivy)
:commands counsel-css
: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! css-mode ; built-in
:defer t
:config
;; contains both css-mode & scss-mode
(set! :docset 'css-mode "CSS")
(set! :docset 'scss-mode "Sass")
(unless EMACS26+
;; css-mode's built in completion is superior
(set-company-backend! '(css-mode scss-mode) 'company-css))
(map! :map scss-mode-map :localleader :n "b" #'+css/scss-build))
(def-package! sass-mode
:defer t
:config
(set! :docset 'sass-mode "Sass")
(set-company-backend! 'sass-mode 'company-css)
(map! :map scss-mode-map :localleader :n "b" #'+css/sass-build))