Rethink smartparens config #181
+ Parts of my smartparens config that were personal preference have been moved to my private module. + The css-mode config was redundant and was removed + Moved lang-specific config to their respective modules + Markdown config was redundant with native electric support, and thus removed.
This commit is contained in:
parent
4ff294e9e1
commit
bb5907cadb
4 changed files with 21 additions and 26 deletions
|
@ -213,27 +213,11 @@ with functions that require it (like modeline segments)."
|
||||||
|
|
||||||
(add-hook 'doom-init-hook #'smartparens-global-mode)
|
(add-hook 'doom-init-hook #'smartparens-global-mode)
|
||||||
(require 'smartparens-config)
|
(require 'smartparens-config)
|
||||||
;; Smartparens interferes with Replace mode
|
|
||||||
|
;; disable smartparens in evil-mode's replace state (they conflict)
|
||||||
(add-hook 'evil-replace-state-entry-hook #'turn-off-smartparens-mode)
|
(add-hook 'evil-replace-state-entry-hook #'turn-off-smartparens-mode)
|
||||||
(add-hook 'evil-replace-state-exit-hook #'turn-on-smartparens-mode)
|
(add-hook 'evil-replace-state-exit-hook #'turn-on-smartparens-mode)
|
||||||
|
|
||||||
;; Auto-close more conservatively
|
|
||||||
(let ((unless-list '(sp-point-before-word-p
|
|
||||||
sp-point-after-word-p
|
|
||||||
sp-point-before-same-p)))
|
|
||||||
(sp-pair "'" nil :unless unless-list)
|
|
||||||
(sp-pair "\"" nil :unless unless-list))
|
|
||||||
(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") ("| " " "))
|
|
||||||
:unless '(sp-point-before-word-p sp-point-before-same-p))
|
|
||||||
(sp-pair "[" nil :post-handlers '(("| " " "))
|
|
||||||
:unless '(sp-point-before-word-p sp-point-before-same-p))
|
|
||||||
|
|
||||||
(sp-local-pair 'css-mode "/*" "*/"
|
|
||||||
:post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC")))
|
|
||||||
(sp-local-pair '(sh-mode markdown-mode) "`" nil
|
|
||||||
:unless '(sp-point-before-word-p sp-point-before-same-p))
|
|
||||||
(sp-local-pair '(xml-mode nxml-mode php-mode) "<!--" "-->"
|
(sp-local-pair '(xml-mode nxml-mode php-mode) "<!--" "-->"
|
||||||
:post-handlers '(("| " "SPC"))))
|
:post-handlers '(("| " "SPC"))))
|
||||||
|
|
||||||
|
|
|
@ -20,14 +20,7 @@
|
||||||
(setq line-spacing 2
|
(setq line-spacing 2
|
||||||
fill-column 80))
|
fill-column 80))
|
||||||
|
|
||||||
(sp-local-pair
|
(map! (:map markdown-mode-map
|
||||||
'(markdown-mode gfm-mode)
|
|
||||||
"\`\`\`" "\`\`\`" :post-handlers '(("||\n" "RET")))
|
|
||||||
|
|
||||||
(map! (:map gfm-mode-map
|
|
||||||
"`" #'self-insert-command)
|
|
||||||
|
|
||||||
(:map markdown-mode-map
|
|
||||||
[remap find-file-at-point] #'markdown-follow-thing-at-point
|
[remap find-file-at-point] #'markdown-follow-thing-at-point
|
||||||
"M-*" #'markdown-insert-list-item
|
"M-*" #'markdown-insert-list-item
|
||||||
"M-b" #'markdown-insert-bold
|
"M-b" #'markdown-insert-bold
|
||||||
|
|
|
@ -35,6 +35,9 @@
|
||||||
(,(regexp-opt +sh-builtin-keywords 'words)
|
(,(regexp-opt +sh-builtin-keywords 'words)
|
||||||
(0 'font-lock-builtin-face append))))
|
(0 'font-lock-builtin-face append))))
|
||||||
|
|
||||||
|
;; autoclose backticks
|
||||||
|
(sp-local-pair 'sh-mode "`" nil :unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||||
|
|
||||||
;; sh-mode has file extensions checks for other shells, but not zsh, so...
|
;; sh-mode has file extensions checks for other shells, but not zsh, so...
|
||||||
(defun +sh|detect-zsh ()
|
(defun +sh|detect-zsh ()
|
||||||
(when (or (and buffer-file-name
|
(when (or (and buffer-file-name
|
||||||
|
|
|
@ -19,6 +19,21 @@
|
||||||
(apply orig-fn args)))
|
(apply orig-fn args)))
|
||||||
(advice-add #'tramp-read-passwd :around #'+hlissner*no-authinfo-for-tramp)
|
(advice-add #'tramp-read-passwd :around #'+hlissner*no-authinfo-for-tramp)
|
||||||
|
|
||||||
|
;;
|
||||||
|
(after! smartparens
|
||||||
|
;; Auto-close more conservatively
|
||||||
|
(let ((unless-list '(sp-point-before-word-p
|
||||||
|
sp-point-after-word-p
|
||||||
|
sp-point-before-same-p)))
|
||||||
|
(sp-pair "'" nil :unless unless-list)
|
||||||
|
(sp-pair "\"" nil :unless unless-list))
|
||||||
|
(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") ("| " " "))
|
||||||
|
:unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||||
|
(sp-pair "[" nil :post-handlers '(("| " " "))
|
||||||
|
:unless '(sp-point-before-word-p sp-point-before-same-p)))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(after! doom-themes
|
(after! doom-themes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue