enhance: both ^ and _ can be autopaired when there's selected text

pull/2507/head
Tienson Qin 2021-07-26 22:31:42 +08:00
parent 2bae2126b4
commit f4a3d76658
1 changed files with 9 additions and 2 deletions

View File

@ -1496,15 +1496,19 @@
"`" "`"
"~" "~"
"*" "*"
;; "_" "_"
"_" "_"
"^" "^"
;; ":" ":" ; TODO: only properties editing and org mode tag
;; "^" "^"
})
(def reversed-autopair-map
(zipmap (vals autopair-map)
(keys autopair-map)))
(defonce autopair-when-selected
#{"^" "_"})
(def delete-map
(assoc autopair-map
"$" "$"
@ -2475,6 +2479,9 @@
(util/stop e)
(cursor/move-cursor-forward input))
(and (autopair-when-selected key) (string/blank? (util/get-selected-text)))
nil
(contains? (set (keys autopair-map)) key)
(do
(util/stop e)