dotfiles/emacs/.emacs.d/init/oni-css-mode-init.org

1.1 KiB

CSS

scss-mode is based on css-mode, so any settings for css-mode also automatically should work for scss-mode.

Enable electric pairing.

  (add-hook 'css-mode-hook 'electric-pair-local-mode)

Enable electric indenting.

  (add-hook 'css-mode-hook 'electric-indent-local-mode)

Enable company mode.

  (add-hook 'css-mode-hook 'company-mode)

Enable rainbow mode to see all the color specifications (well, most) as pretty colors.

  (add-hook 'css-mode-hook 'rainbow-mode)

Add the scssc compiler's error message output to the compilation error regexps.

  (eval-when-compile (require 'compile))

  (with-eval-after-load 'compile
    (defvar oni:scss-error-regexp
      (rx (and bol
               (zero-or-more space) "on line "
               (group (one-or-more digit)) " of "
               (group (one-or-more (or word punct (syntax symbol))))
               eol)))

    (add-to-list 'compilation-error-regexp-alist
                 (list oni:scss-error-regexp 2 1 nil 2 2)))