78 lines
2.6 KiB
EmacsLisp
78 lines
2.6 KiB
EmacsLisp
;;; oni-align.el --- Alignment configuration -*- lexical-binding: t; -*-
|
|
|
|
;; Copyright (C) 2018 Tom Willemse
|
|
|
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
|
;; Keywords: local
|
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
;; (at your option) any later version.
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;; GNU General Public License for more details.
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
;;; Commentary:
|
|
|
|
;; Configuration for several alignment options.
|
|
|
|
;;; Code:
|
|
|
|
(require 'align)
|
|
|
|
;; Align CSS files like so:
|
|
|
|
;; body { color: #ffffff; }
|
|
;; .some-class { background-color: #ffffff; }
|
|
;; #some-id { width: 200px; }
|
|
|
|
;; .some-more-class {
|
|
;; color: #ffffff;
|
|
;; background-color: #ffffff;
|
|
;; width: 200px;
|
|
;; }
|
|
|
|
;; Keep these in order. They are each added to the _front_ of the
|
|
;; list and are applied in order. Changing their order will change
|
|
;; the results.
|
|
(add-to-list 'align-rules-list
|
|
`(css-closing-brace
|
|
(regexp . ,(rx (group (0+ whitespace)) "}" eol))
|
|
(group . (1))
|
|
(modes . '(scss-mode css-mode))))
|
|
|
|
(add-to-list 'align-rules-list
|
|
`(css-colons
|
|
(regexp . ,(rx bol
|
|
(0+ whitespace)
|
|
(1+ (any (?a . ?z) ?- ?$))
|
|
":"
|
|
(group (0+ whitespace))
|
|
(0+ nonl)
|
|
";"
|
|
eol))
|
|
(group . (1))
|
|
(modes . '(scss-mode css-mode))
|
|
(repeat . t)))
|
|
|
|
(add-to-list 'align-rules-list
|
|
`(css-opening-brace
|
|
(regexp . ,(rx bol
|
|
(0+ whitespace)
|
|
(0+ (any ?# ?. ?, ?\s ?& ?: ?-
|
|
(?a . ?z) (?A . ?Z) (?0 . ?9)))
|
|
(any (?a . ?z) (?A . ?Z) (?0 . ?9))
|
|
(group (0+ whitespace))
|
|
"{"
|
|
(0+ nonl)))
|
|
(group . (1))
|
|
(modes . '(scss-mode css-mode))))
|
|
|
|
(provide 'oni-align)
|
|
;;; oni-align.el ends here
|