Revise smartparens doc comments
This commit is contained in:
parent
096ca1e4cc
commit
17c1759457
1 changed files with 10 additions and 8 deletions
|
@ -28,13 +28,13 @@
|
||||||
|
|
||||||
|
|
||||||
(when (featurep! +smartparens)
|
(when (featurep! +smartparens)
|
||||||
;; disable :unless predicates with (sp-pair "'" nil :unless nil)
|
;; You can disable :unless predicates with (sp-pair "'" nil :unless nil)
|
||||||
;; disable :post-handlers with (sp-pair "{" nil :post-handlers nil)
|
;; And disable :post-handlers with (sp-pair "{" nil :post-handlers nil)
|
||||||
;; ...or specific :post-handlers with (sp-pair "{" nil :post-handlers '(:rem
|
;; or specific :post-handlers with:
|
||||||
;; ("| " "SPC")))
|
;; (sp-pair "{" nil :post-handlers '(:rem ("| " "SPC")))
|
||||||
(after! smartparens
|
(after! smartparens
|
||||||
;; Autopair quotes more conservatively; if I'm next to a word/before another
|
;; Autopair quotes more conservatively; if I'm next to a word/before another
|
||||||
;; quote, I likely don't want another pair.
|
;; quote, I likely don't want to open a new pair.
|
||||||
(let ((unless-list '(sp-point-before-word-p
|
(let ((unless-list '(sp-point-before-word-p
|
||||||
sp-point-after-word-p
|
sp-point-after-word-p
|
||||||
sp-point-before-same-p)))
|
sp-point-before-same-p)))
|
||||||
|
@ -60,11 +60,13 @@
|
||||||
(sp-local-pair '(emacs-lisp-mode org-mode markdown-mode gfm-mode)
|
(sp-local-pair '(emacs-lisp-mode org-mode markdown-mode gfm-mode)
|
||||||
"[" nil :post-handlers '(:rem ("| " "SPC")))
|
"[" nil :post-handlers '(:rem ("| " "SPC")))
|
||||||
|
|
||||||
;; Reasonable default pairs for comments
|
;; Reasonable default pairs for HTML-style comments
|
||||||
(sp-local-pair (append sp--html-modes '(markdown-mode gfm-mode))
|
(sp-local-pair (append sp--html-modes '(markdown-mode gfm-mode))
|
||||||
"<!--" "-->" :actions '(insert) :post-handlers '(("| " "SPC")))
|
"<!--" "-->" :actions '(insert) :post-handlers '(("| " "SPC")))
|
||||||
|
|
||||||
;; Expand C-style doc comment blocks
|
;; Expand C-style doc comment blocks. Must be done manually because some of
|
||||||
|
;; these languages use specialized (and deferred) parsers, whose state we
|
||||||
|
;; can't access while smartparens is doing its thing.
|
||||||
(defun +default-expand-doc-comment-block (&rest _ignored)
|
(defun +default-expand-doc-comment-block (&rest _ignored)
|
||||||
(let ((indent (current-indentation)))
|
(let ((indent (current-indentation)))
|
||||||
(newline-and-indent)
|
(newline-and-indent)
|
||||||
|
@ -94,7 +96,7 @@
|
||||||
;; f) do none of this when inside a string
|
;; f) do none of this when inside a string
|
||||||
(advice-add #'delete-backward-char :override #'doom/delete-backward-char)
|
(advice-add #'delete-backward-char :override #'doom/delete-backward-char)
|
||||||
|
|
||||||
;; Makes `newline-and-indent' smarter when dealing with comments
|
;; Makes `newline-and-indent' continue comments (and more reliably)
|
||||||
(advice-add #'newline-and-indent :around #'doom*newline-indent-and-continue-comments)))
|
(advice-add #'newline-and-indent :around #'doom*newline-indent-and-continue-comments)))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue