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

@ -44,10 +44,6 @@
(sp-local-pair 'ruby-mode "{" "}"
:pre-handlers '(:rem sp-ruby-prehandler)
:post-handlers '(:rem sp-ruby-posthandler))
;; sp's default rules for these modes are obnoxious, so disable them
(provide 'smartparens-elixir)
(provide 'smartparens-latex)
(provide 'smartparens-lua)
;; Expand {|} => { | }
;; Expand {|} => {
@ -63,6 +59,18 @@
(sp-local-pair '(emacs-lisp-mode org-mode markdown-mode gfm-mode)
"[" nil :post-handlers '(:rem ("| " "SPC")))
;; Reasonable default pairs for comments
(sp-local-pair (append sp--html-modes '(markdown-mode gfm-mode))
"<!--" "-->" :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]" "*")))
;; Highjacks backspace to:
;; a) balance spaces inside brackets/parentheses ( | ) -> (|)
;; b) delete space-indented `tab-width' steps at a time