Refactor smartparens default rules

Move them to config/default, but move single-lang-specific ones to their
respective modules.
This commit is contained in:
Henrik Lissner 2018-06-25 15:54:38 +02:00
parent 1d7782aea3
commit 8a4f15b01c
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
5 changed files with 25 additions and 18 deletions

View file

@ -157,10 +157,7 @@ fundamental-mode) for performance sake."
sp-navigate-consider-sgml-tags nil))
(add-hook 'after-change-major-mode-hook #'doom|disable-smartparens-navigate-skip-match)
;; smartparenss conflicts with evil-mode's replace state
(add-hook 'evil-replace-state-entry-hook #'turn-off-smartparens-mode)
(add-hook 'evil-replace-state-exit-hook #'turn-on-smartparens-mode)
;; autopairing in `eval-expression' and `evil-ex'
(defun doom|init-smartparens-in-eval-expression ()
"Enable `smartparens-mode' in the minibuffer, during `eval-expression' or
`evil-ex'."
@ -169,16 +166,9 @@ fundamental-mode) for performance sake."
(add-hook 'minibuffer-setup-hook #'doom|init-smartparens-in-eval-expression)
(sp-local-pair 'minibuffer-inactive-mode "'" nil :actions nil)
(sp-local-pair sp--html-modes "<!--" "-->"
:actions '(insert) :post-handlers '(("| " "SPC")))
(sp-local-pair
'(js2-mode typescript-mode rjsx-mode rust-mode
c-mode c++-mode objc-mode java-mode php-mode
css-mode scss-mode less-css-mode stylus-mode)
"/*" "*/"
:actions '(insert)
:post-handlers '(("| " "SPC") ("|\n*/[i][d-2]" "RET") ("\n* ||\n*/[i][d-2]" "*")))
;; smartparenss conflicts with evil-mode's replace state
(add-hook 'evil-replace-state-entry-hook #'turn-off-smartparens-mode)
(add-hook 'evil-replace-state-exit-hook #'turn-on-smartparens-mode)
(smartparens-global-mode +1))