Improve smartparens config
This commit is contained in:
parent
cc6c9b33c2
commit
99d5de31a7
1 changed files with 9 additions and 10 deletions
|
@ -15,21 +15,20 @@
|
||||||
(setq sp-autowrap-region nil ; let evil-surround handle this
|
(setq sp-autowrap-region nil ; let evil-surround handle this
|
||||||
sp-highlight-pair-overlay nil
|
sp-highlight-pair-overlay nil
|
||||||
sp-show-pair-delay 0
|
sp-show-pair-delay 0
|
||||||
sp-autoescape-string-quote t)
|
sp-autoescape-string-quote nil)
|
||||||
|
|
||||||
;; Handle newlines
|
;; Handle newlines + spaces
|
||||||
(sp-pair "{" nil :post-handlers '(("||\n[i]" "RET")))
|
(sp-pair "{" "}" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")) :unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||||
(sp-pair "[" nil :post-handlers '(("||\n[i]" "RET")))
|
(sp-pair "(" ")" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")) :unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||||
(sp-with-modes '(emacs-lisp-mode lisp-mode)
|
|
||||||
(sp-local-pair "[" nil :post-handlers '(("|" "RET"))))
|
|
||||||
|
|
||||||
;; Auto-close more conservatively
|
;; Auto-close more conservatively
|
||||||
(sp-pair "[" nil :unless '(sp-point-before-word-p sp-point-before-same-p))
|
(sp-pair "[" nil :unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||||
(sp-pair "(" nil :unless '(sp-point-before-word-p sp-point-before-same-p))
|
|
||||||
(sp-pair "\"" nil :unless '(sp-point-after-word-p sp-point-before-word-p sp-point-before-same-p))
|
|
||||||
(sp-pair "'" nil :unless '(sp-point-after-word-p sp-point-before-word-p sp-point-before-same-p))
|
(sp-pair "'" nil :unless '(sp-point-after-word-p sp-point-before-word-p sp-point-before-same-p))
|
||||||
(sp-pair "\"" nil :unless '(sp-point-after-word-p sp-point-before-word-p sp-point-before-same-p))
|
(sp-pair "\"" nil :unless '(sp-point-after-word-p sp-point-before-word-p sp-point-before-same-p))
|
||||||
|
|
||||||
|
(sp-with-modes '(json-mode js2-mode ruby-mode enh-ruby-mode python-mode)
|
||||||
|
(sp-local-pair "[" "]" :post-handlers '(:add "| " "SPC")))
|
||||||
|
|
||||||
(after "yasnippet"
|
(after "yasnippet"
|
||||||
(defadvice yas-expand (before advice-for-yas-expand activate)
|
(defadvice yas-expand (before advice-for-yas-expand activate)
|
||||||
(sp-remove-active-pair-overlay)))))
|
(sp-remove-active-pair-overlay)))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue