lang/{javascript,web}: add web-beautify plugin

This commit is contained in:
Henrik Lissner 2017-03-23 15:47:07 -04:00
parent 0243229690
commit 495b0d0016
4 changed files with 20 additions and 3 deletions

View file

@ -93,6 +93,11 @@
:init (setq coffee-indent-like-python-mode t)) :init (setq coffee-indent-like-python-mode t))
(def-package! web-beautify :commands web-beautify-js
:init
(map! :map* (json-mode js2-mode-map) :n "gQ" 'web-beautify-js))
;; ;;
;; Projects ;; Projects
;; ;;

View file

@ -7,6 +7,7 @@
(package! jsx-mode) (package! jsx-mode)
(package! nodejs-repl) (package! nodejs-repl)
(package! tern) (package! tern)
(package! web-beautify)
(when (featurep! :completion company) (when (featurep! :completion company)
(package! company-tern)) (package! company-tern))
@ -16,7 +17,7 @@
;; ;;
(def-bootstrap! javascript (def-bootstrap! javascript
(unless (cl-every 'executable-find '("node" "npm" "tern")) (unless (cl-every 'executable-find '("node" "npm" "tern" "js-beautify"))
(pcase (doom-system-os) (pcase (doom-system-os)
('arch ('arch
(let (progs) (let (progs)
@ -31,6 +32,7 @@
(unless (executable-find "node") (unless (executable-find "node")
(error "Failed to install NodeJS")) (error "Failed to install NodeJS"))
(unless (executable-find "tern") (unless (executable-find "tern")
(funcall (if (file-writable-p (executable-find "npm")) 'sh 'sudo) (sh "npm -g install tern"))
"npm -g install tern")) (unless (executable-find "js-beautify")
(sh "npm -g install js-beautify"))
t)) t))

View file

@ -4,6 +4,15 @@
(load! +css) (load! +css)
(def-package! web-beautify
:commands (web-beautify-html web-beautify-css)
:init
(map! (:map* (css-mode-map scss-mode-map less-css-mode-map)
:n "gQ" 'web-beautify-css)
(:map* web-mode-map
:n "gQ" 'web-beautify-html)))
;; ;;
;; Frameworks ;; Frameworks
;; ;;

View file

@ -2,6 +2,7 @@
;;; lang/web/packages.el ;;; lang/web/packages.el
(package! rainbow-mode) (package! rainbow-mode)
(package! web-beautify)
(when (featurep! :completion ivy) (when (featurep! :completion ivy)
(package! counsel-css :recipe (:fetcher github :repo "hlissner/emacs-counsel-css"))) (package! counsel-css :recipe (:fetcher github :repo "hlissner/emacs-counsel-css")))