Calling this pivotal macro "def-package!" has frequently been a source of confusion. It is a thin wrapper around use-package, and it should be obvious that it is so. For this reason, and to match the naming convention used with other convenience macros/wrappers, it is now use-package!. Also changes def-package-hook! -> use-package-hook! The old macros are now marked obsolete and will be removed when straight integration is merged.
70 lines
1.9 KiB
EmacsLisp
70 lines
1.9 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)
|
|
|
|
(map! :map (css-mode-map scss-mode-map less-css-mode-map)
|
|
:localleader
|
|
"rb" #'+css/toggle-inline-or-block)
|
|
|
|
(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))]))
|
|
|
|
(after! projectile
|
|
(pushnew! projectile-other-file-alist
|
|
'("css" "scss" "sass" "less" "styl")
|
|
'("scss" "css")
|
|
'("sass" "css")
|
|
'("less" "css")
|
|
'("styl" "css")))
|
|
|
|
|
|
;;
|
|
;;; Major modes
|
|
|
|
(add-hook! (css-mode sass-mode stylus-mode) #'rainbow-mode)
|
|
|
|
;; built-in, and contains both css-mode & scss-mode
|
|
(after! css-mode
|
|
;; css-mode hooks apply to scss and less-css modes
|
|
(add-hook 'css-mode-hook #'rainbow-delimiters-mode)
|
|
(set-company-backend! '(css-mode scss-mode)
|
|
(if EMACS26+
|
|
;; css-mode's built in completion is superior in 26+
|
|
'company-capf
|
|
'company-css))
|
|
(map! :map scss-mode-map :localleader "b" #'+css/scss-build))
|
|
|
|
|
|
(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 sass-mode less-css-mode) #'lsp!))
|
|
|
|
|
|
(use-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 ";" #'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))
|