mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
Move smartparens configs to modules
This commit is contained in:
@ -237,6 +237,7 @@ enable multiple minor modes for the same regexp.")
|
||||
(add-hook 'evil-replace-state-exit-hook 'turn-on-smartparens-mode)
|
||||
|
||||
;; Auto-close more conservatively
|
||||
(sp-pair "'" nil :unless '(sp-point-after-word-p))
|
||||
(sp-pair "{" nil :post-handlers '(("||\n[i]" "RET") ("| " " "))
|
||||
:unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||
(sp-pair "(" nil :post-handlers '(("||\n[i]" "RET") ("| " " "))
|
||||
@ -244,64 +245,12 @@ enable multiple minor modes for the same regexp.")
|
||||
(sp-pair "[" nil :post-handlers '(("| " " "))
|
||||
:unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||
|
||||
(defun sp-point-in-string-p (id action context)
|
||||
(when (eq action 'insert)
|
||||
(sp-point-in-string)))
|
||||
|
||||
(defun sp-insert-yasnippet (id action context)
|
||||
(forward-char -1)
|
||||
(if (sp-point-after-bol-p id action context)
|
||||
(yas-expand-from-trigger-key)
|
||||
(forward-char)))
|
||||
|
||||
(sp-local-pair 'css-mode "/*" "*/" :post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC")))
|
||||
(sp-local-pair '(sh-mode markdown-mode) "`" "`" :unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||
(sp-local-pair 'markdown-mode "```" "```" :post-handlers '(("||\n[i]" "RET")) :unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||
|
||||
(sp-local-pair '(scss-mode css-mode) "/*" "*/" :post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC")))
|
||||
|
||||
(sp-with-modes '(sh-mode)
|
||||
(sp-local-pair "case" "" :when '(("SPC")) :post-handlers '((:add sp-insert-yasnippet)) :actions '(insert))
|
||||
(sp-local-pair "if" "" :when '(("SPC")) :post-handlers '((:add sp-insert-yasnippet)) :actions '(insert))
|
||||
(sp-local-pair "for" "" :when '(("SPC")) :post-handlers '((:add sp-insert-yasnippet)) :actions '(insert))
|
||||
(sp-local-pair "elif" "" :when '(("SPC")) :post-handlers '((:add sp-insert-yasnippet)) :actions '(insert))
|
||||
(sp-local-pair "while" "" :when '(("SPC")) :post-handlers '((:add sp-insert-yasnippet)) :actions '(insert)))
|
||||
|
||||
(sp-with-modes '(c-mode c++-mode objc-mode php-mode java-mode)
|
||||
(sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
|
||||
|
||||
;; Doxygen blocks
|
||||
(sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET") ("||\n[i]" "SPC")))
|
||||
(sp-local-pair "/*!" "*/" :post-handlers '(("||\n[i]" "RET") ("[d-1]< | " "SPC"))))
|
||||
|
||||
(defun sp--org-skip-asterisk (ms mb me)
|
||||
(or (and (= (line-beginning-position) mb)
|
||||
(eq 32 (char-after (1+ mb))))
|
||||
(and (= (1+ (line-beginning-position)) me)
|
||||
(eq 32 (char-after me)))))
|
||||
|
||||
(sp-with-modes '(org-mode)
|
||||
(sp-local-pair "*" "*" :unless '(sp-point-after-word-p sp-point-at-bol-p) :skip-match 'sp--org-skip-asterisk)
|
||||
(sp-local-pair "_" "_" :unless '(sp-point-before-word-p sp-point-after-word-p))
|
||||
(sp-local-pair "/" "/" :unless '(sp-point-before-word-p sp-point-after-word-p) :post-handlers '(("[d1]" "SPC")))
|
||||
(sp-local-pair "~" "~" :unless '(sp-point-before-word-p sp-point-after-word-p) :post-handlers '(("[d1]" "SPC")))
|
||||
(sp-local-pair "=" "=" :unless '(sp-point-before-word-p sp-point-after-word-p) :post-handlers '(("[d1]" "SPC")))
|
||||
|
||||
(sp-local-pair "\\[" "\\]" :post-handlers '(("| " "SPC")))
|
||||
(sp-local-pair "\\(" "\\)" :post-handlers '(("| " "SPC")))
|
||||
(sp-local-pair "$$" "$$" :post-handlers '((:add " | ")) :unless '(sp-point-at-bol-p))
|
||||
(sp-local-pair "{" nil))
|
||||
|
||||
;; Markup languages
|
||||
(sp-with-modes '(xml-mode nxml-mode php-mode)
|
||||
(sp-local-pair "<!--" "-->" :post-handlers '(("| " "SPC"))))
|
||||
(sp-with-modes '(web-mode php-mode)
|
||||
(sp-local-pair "<?" "?>" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
|
||||
(sp-local-pair "<?php " " ?>" :post-handlers '(("||\n[i]" "RET") ("| " "SPC"))))
|
||||
(sp-with-modes '(web-mode)
|
||||
(sp-local-pair "{{!--" "--}}" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
|
||||
(sp-local-pair "<%" "%>" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
|
||||
(sp-local-pair "{!!" "!!}" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
|
||||
(sp-local-pair "{#" "#}" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))))
|
||||
(sp-local-pair "<!--" "-->" :post-handlers '(("| " "SPC")))))
|
||||
|
||||
(use-package help-fns+ ; Improved help commands
|
||||
:commands (describe-buffer describe-command describe-file
|
||||
|
Reference in New Issue
Block a user