From 1c3f4c8171ee30fcdbfd474c8e6bc6842a22be4d Mon Sep 17 00:00:00 2001 From: Miao Jiang Date: Mon, 28 Jan 2019 22:42:59 +0800 Subject: [PATCH] Fix #239 extra space in quotes --- README.md | 2 +- plugin/auto-pairs.vim | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a65845a..d467cf9 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ Options ------- * g:AutoPairs - Default: {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'} + Default: {'(':')', '[':']', '{':'}',"'":"'",'"':'"', "`":"`", '```':'```', '"""':'"""', "'''":"'''"} * b:AutoPairs diff --git a/plugin/auto-pairs.vim b/plugin/auto-pairs.vim index 7ee07a7..99bf15b 100644 --- a/plugin/auto-pairs.vim +++ b/plugin/auto-pairs.vim @@ -13,7 +13,7 @@ end let g:AutoPairsLoaded = 1 if !exists('g:AutoPairs') - let g:AutoPairs = {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '```':'```', '"""':'"""', "'''":"'''"} + let g:AutoPairs = {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '```':'```', '"""':'"""', "'''":"'''", "`":"`"} end if !exists('g:AutoPairsMapBS') @@ -410,7 +410,11 @@ func! AutoPairsSpace() continue end if before =~ '\V'.open.'\v$' && after =~ '^\V'.close - return "\\".s:Left + if close =~ '\v^[''"`]$' + return "\" + else + return "\\".s:Left + end end endfor return "\"