From a5142b0e99e0b24bf3e7c1b7bfabfdd9612b6a1f Mon Sep 17 00:00:00 2001 From: Miao Jiang Date: Thu, 24 Jan 2019 13:16:21 +0800 Subject: [PATCH] Check open pair before close, fix #237 --- plugin/auto-pairs.vim | 89 ++++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 44 deletions(-) diff --git a/plugin/auto-pairs.vim b/plugin/auto-pairs.vim index 9daa1b7..2c1f6c2 100644 --- a/plugin/auto-pairs.vim +++ b/plugin/auto-pairs.vim @@ -187,6 +187,51 @@ func! AutoPairsInsert(key) return a:key end + " check open pairs + for [open, close, opt] in b:AutoPairsList + let ms = s:matchend(before.a:key, open) + if len(ms) > 0 + " process the open pair + + " remove inserted pair + " eg: if the pairs include < > and + " when - " when