feat: Also add equal-pair-detecting check when deleting pairs

This commit is contained in:
Kim K 2019-02-17 15:38:37 +01:00
parent 4f1c46b84a
commit 9984b255c0
3 changed files with 18 additions and 2 deletions

View File

@ -99,6 +99,16 @@ Features
---
input:
((|)
(press <BS> at |)
output:
(|)
---
input:
|]]

View File

@ -281,8 +281,9 @@ Jump to the next closed pair.
Default: 1
Detects when to close a pair by detecting the equality of pairs within the
current buffer. (This feature is not supported for multibyte pairs)
Detects when to close a pair and how to delete an existing pair by detecting the
equality of pairs within the current buffer. (This feature is not supported for
multibyte pairs)
*g:AutoPairsShortcutBackInsert*

View File

@ -342,6 +342,11 @@ func! AutoPairsDelete()
return "\<BS>"
end
end
if strlen(open) == 1 && g:AutoPairsEqualPairDetection == 1
if s:count(open) !=# s:count(close)
return s:backspace(b)
endif
endif
return s:backspace(b).s:delete(a)
end
endfor