Move web-mode smartparens config into core-editor

This commit is contained in:
Henrik Lissner 2015-08-23 01:00:04 -04:00
parent 5a4839a4a4
commit 6dd7cc65f1
2 changed files with 10 additions and 11 deletions

View file

@ -195,7 +195,16 @@
(sp-local-pair "/*" "" :post-handlers '((" ||\n[i]*/" "RET")))) (sp-local-pair "/*" "" :post-handlers '((" ||\n[i]*/" "RET"))))
(after! yasnippet (after! yasnippet
(advice-add 'yas-expand :before 'sp-remove-active-pair-overlay))) (advice-add 'yas-expand :before 'sp-remove-active-pair-overlay))
(after! web-mode
(add-hook! web-mode (setq web-mode-enable-auto-pairing nil))
(defun sp-web-mode-is-code-context (id action context)
(when (and (eq action 'insert)
(not (or (get-text-property (point) 'part-side)
(get-text-property (point) 'block-side))))
t))
(sp-local-pair 'web-mode "<" nil :when '(sp-web-mode-is-code-context))))
(use-package smex (use-package smex
:commands (smex smex-major-mode-commands smex-initialize smex-update) :commands (smex smex-major-mode-commands smex-initialize smex-update)

View file

@ -23,16 +23,6 @@
web-mode-script-padding 2 web-mode-script-padding 2
web-mode-block-padding 2) web-mode-block-padding 2)
:config :config
(after! smartparens
(add-hook! web-mode (setq web-mode-enable-auto-pairing nil))
(defun sp-web-mode-is-code-context (id action context)
(when (and (eq action 'insert)
(not (or (get-text-property (point) 'part-side)
(get-text-property (point) 'block-side))))
t))
(sp-local-pair 'web-mode "<" nil :when '(sp-web-mode-is-code-context)))
(after! web-beautify (after! web-beautify
(add-hook! web-mode (setenv "jsbeautify_indent_size" "4")) (add-hook! web-mode (setenv "jsbeautify_indent_size" "4"))
(bind! :map web-mode-map :m "gQ" 'web-beautify-html)) (bind! :map web-mode-map :m "gQ" 'web-beautify-html))