Add css-mode hydra

This commit is contained in:
Tom Willemse 2018-07-09 19:41:35 -07:00
parent 22e8fdafa0
commit 4524ea0ed6

View file

@ -25,6 +25,7 @@
;;; Code:
(require 'css-mode)
(require 'hydra)
(eval-when-compile (require 'compile))
(defun oni:css-property-important-p ()
@ -51,7 +52,7 @@
(when (re-search-backward " !important" (line-beginning-position) :noerror)
(replace-match "")))))
(defun oni:css-toggle-important ()
(defun oni-css-mode-init--toggle-important ()
"Toggle the important flag on the property on the current line."
(interactive)
(if (oni:css-property-important-p)
@ -74,7 +75,10 @@
(add-to-list 'compilation-error-regexp-alist
(list oni:scss-error-regexp 2 1 nil 2 2)))
(define-key css-mode-map (kbd "C-c !") #'oni:css-toggle-important)
(defhydra css-mode-hydra (:color blue)
("!" oni-css-mode-init--toggle-important))
(define-key css-mode-map (kbd "C-c m") #'css-mode-hydra/body)
(provide 'oni-css-mode-init)
;;; oni-css-mode-init.el ends here