fix(evil): handle edge cases of embrace
If the surround key is `\(`, the text should be surrounded as `\( text \)`. The same for `\[` and `\{`.
This commit is contained in:
parent
dabca5d24e
commit
c09777b36b
1 changed files with 5 additions and 4 deletions
|
@ -17,10 +17,11 @@
|
||||||
(let ((char (read-char "\\")))
|
(let ((char (read-char "\\")))
|
||||||
(if (eq char 27)
|
(if (eq char 27)
|
||||||
(cons "" "")
|
(cons "" "")
|
||||||
(let ((pair (+evil--embrace-get-pair (string char)))
|
(let* ((pair (+evil--embrace-get-pair (string char)))
|
||||||
(text (if (sp-point-in-string) "\\\\%s" "\\%s")))
|
(escape (if (sp-point-in-string) "\\\\" "\\"))
|
||||||
(cons (format text (car pair))
|
(escape (format "\\1%s" (regexp-quote escape))))
|
||||||
(format text (cdr pair)))))))
|
(cons (replace-regexp-in-string "^\\( *\\)" escape (car pair))
|
||||||
|
(replace-regexp-in-string "^\\( *\\)" escape (cdr pair)))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +evil--embrace-latex ()
|
(defun +evil--embrace-latex ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue