diff --git a/init/init-js.el b/init/init-js.el index e63802211..cfec165ec 100644 --- a/init/init-js.el +++ b/init/init-js.el @@ -3,6 +3,7 @@ :interpreter "node" :config (progn + (setq js2-skip-preprocessor-directives t) (setq-default js2-show-parse-errors nil) (setq-default js2-global-externs '("module" "require" "buster" "sinon" "assert" "refute" "setTimeout" "clearTimeout" @@ -11,11 +12,14 @@ ;; Launchbar API "LaunchBar" "File" "Action" "HTTP" "include")) + (after "web-beautify" + (add-hook! 'js2-mode-hook (setenv "jsbeautify_indent_size" "4")) + (bind 'motion js2-mode-map "gQ" 'web-beautify-js)) + (after "emr" (use-package js2-refactor)) (use-package tern :commands tern-mode - ;; replace auto-complete with tern-ac-complete only in js-mode :init (progn (add-hook 'js2-mode-hook 'tern-mode) @@ -40,9 +44,8 @@ )))))) (use-package json-mode - :mode (("\\.json\\'" . json-mode) - ("\\.jshintrc\\'" . json-mode))) - + :mode (("\\.json$" . json-mode) + ("\\.jshintrc$" . json-mode))) (provide 'init-js) diff --git a/init/init-php.el b/init/init-php.el index e667f07a2..6919b1a97 100644 --- a/init/init-php.el +++ b/init/init-php.el @@ -2,8 +2,15 @@ :mode "\\.\\(php\\|inc\\)$" :config (progn - (add-hook! 'php-mode-hook (setq my-run-code-interpreter "php")) - (setq php-template-compatibility nil))) + (setq php-template-compatibility nil) + (add-hook 'php-mode-hook 'turn-on-eldoc-mode) + + (use-package php-extras + :config (company--backend-on 'php-mode-hook 'php-extras-company)) + + ;; TODO Tie into emr + (use-package php-refactor-mode + :config (add-hook 'php-mode-hook 'php-refactor-mode)))) (provide 'init-php) diff --git a/init/init-scss.el b/init/init-scss.el index a7a0783ff..e3cbe8839 100644 --- a/init/init-scss.el +++ b/init/init-scss.el @@ -3,13 +3,16 @@ :config (progn (add-hook 'scss-mode-hook 'enable-tab-width-2) - (add-hook 'scss-mode-hook 'ac-css-mode-setup) (setq-default css-indent-offset 2) (setq scss-compile-at-save nil) - (after "company" - (company--backend-on 'scss-mode-hook 'company-css)))) + (after "web-beautify" + (add-hook! 'scss-mode-hook (setenv "jsbeautify_indent_size" "2")) + (bind 'motion scss-mode-map "gQ" 'web-beautify-css)) + + (after "auto-complete" (add-hook 'scss-mode-hook 'ac-css-mode-setup)) + (after "company" (company--backend-on 'scss-mode-hook 'company-css)))) (use-package rainbow-mode :defer t diff --git a/init/init-web.el b/init/init-web.el index 618ab39ed..933a05fe1 100644 --- a/init/init-web.el +++ b/init/init-web.el @@ -1,3 +1,10 @@ +(use-package web-beautify + :commands (web-beautify-js web-beautify-css web-beautify-html) + :init + (after "css-mode" + (add-hook! 'css-mode-hook (setenv "jsbeautify_indent_size" "2")) + (bind 'motion css-mode-map "gQ" 'web-beautify-css))) + (use-package web-mode :mode (("\\.\\(p\\)?htm\\(l\\)?$" . web-mode) ("\\.tpl\\(\\.php\\)?$" . web-mode) @@ -15,6 +22,10 @@ web-mode-script-padding 2 web-mode-block-padding 2) + (after "web-beautify" + (add-hook! 'web-mode-hook (setenv "jsbeautify_indent_size" "4")) + (bind 'motion web-mode-map "gQ" 'web-beautify-html)) + (bind web-mode-map (kbd "s-/") 'web-mode-comment-or-uncomment) (bind 'normal web-mode-map "zf" 'web-mode-fold-or-unfold @@ -43,22 +54,6 @@ (kbd "s-e") 'emmet-expand-yas (kbd "s-E") 'emmet-expand-line))) -(use-package web-beautify - :commands (web-beautify-js web-beautify-css web-beautify-html) - :config - (progn - (after "scss-mode" - (add-hook! 'scss-mode-hook (setenv "jsbeautify_indent_size" "2")) - (bind 'motion scss-mode-map "gQ" 'web-beautify-css)) - - (after "web-mode" - (add-hook! 'web-mode-hook (setenv "jsbeautify_indent_size" "4")) - (bind 'motion web-mode-map "gQ" 'web-beautify-html)) - - (after "js2-mode" - (add-hook! 'js2-mode-hook (setenv "jsbeautify_indent_size" "4")) - (bind 'motion js2-mode-map "gQ" 'web-beautify-js)))) - (provide 'init-web) ;;; init-web.el ends here