diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 058e86e..5fa6186 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -145,7 +145,9 @@ ;;;; Lazy configurations: -(with-eval-after-load 'bookmark (load "init/oni-bookmarks")) +(with-eval-after-load 'bookmark (load "init/oni-bookmark")) +(with-eval-after-load 'align (load "init/oni-align")) +(with-eval-after-load 'browse-url (load "init/oni-browse-url")) (provide 'init) ;;; init.el ends here diff --git a/emacs/.emacs.d/init/oni-align.el b/emacs/.emacs.d/init/oni-align.el index c42a5dd..9e42e3f 100644 --- a/emacs/.emacs.d/init/oni-align.el +++ b/emacs/.emacs.d/init/oni-align.el @@ -26,7 +26,69 @@ (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)))) + +;; In PHP code it's nice to have any ~=>~ aligned. + +;; 'bar', +;; 'frob' => 'baz' +;; ); +;; ?> + +(add-to-list 'align-rules-list + `(php-array-arrow + (regexp . ,(rx any (group whitespace) "=>" any)) + (group . (1)) + (modes . '(php-mode web-mode)) + (repeat . t))) (provide 'oni-align) ;;; oni-align.el ends here diff --git a/emacs/.emacs.d/init/oni-bookmarks.el b/emacs/.emacs.d/init/oni-bookmark.el similarity index 100% rename from emacs/.emacs.d/init/oni-bookmarks.el rename to emacs/.emacs.d/init/oni-bookmark.el