config/default: add smartparens fix for markdown asterixes
This commit is contained in:
parent
ff5769f117
commit
e39a458be7
1 changed files with 21 additions and 0 deletions
|
@ -138,6 +138,27 @@
|
||||||
:actions '(insert)
|
:actions '(insert)
|
||||||
:post-handlers '(("| " "SPC") ("|\n[i]*)[d-2]" "RET")))))
|
:post-handlers '(("| " "SPC") ("|\n[i]*)[d-2]" "RET")))))
|
||||||
|
|
||||||
|
(after! smartparens-markdown
|
||||||
|
(sp-with-modes '(markdown-mode gfm-mode)
|
||||||
|
(sp-local-pair "```" "```" :post-handlers '(:add ("||\n[i]" "RET")))
|
||||||
|
|
||||||
|
;; The original rules for smartparens had an odd quirk: inserting two
|
||||||
|
;; asterixex would replace nearby quotes with asterixes. These two rules
|
||||||
|
;; set out to fix this.
|
||||||
|
(sp-local-pair "**" nil :actions :rem)
|
||||||
|
(sp-local-pair "*" "*"
|
||||||
|
:actions '(insert skip)
|
||||||
|
:unless '(:rem sp-point-at-bol-p)
|
||||||
|
;; * then SPC will delete the second asterix and assume
|
||||||
|
;; you wanted a bullet point. * followed by another *
|
||||||
|
;; will produce an extra, assuming you wanted **|**.
|
||||||
|
:post-handlers '(("[d1]" "SPC") ("|*" "*"))))
|
||||||
|
|
||||||
|
;; This keybind allows * to skip over **.
|
||||||
|
(map! :map markdown-mode-map
|
||||||
|
:ig "*" (λ! (if (looking-at-p "\\*\\* *$")
|
||||||
|
(forward-char 2)
|
||||||
|
(call-interactively 'self-insert-command)))))
|
||||||
|
|
||||||
;; Highjacks backspace to:
|
;; Highjacks backspace to:
|
||||||
;; a) balance spaces inside brackets/parentheses ( | ) -> (|)
|
;; a) balance spaces inside brackets/parentheses ( | ) -> (|)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue