diff --git a/README.md b/README.md index 8d079ba..6882515 100644 --- a/README.md +++ b/README.md @@ -241,6 +241,13 @@ Options Work with FlyMode, insert the key at the Fly Mode jumped postion +* g:AutoPairsIgnoreCharacters + + Default : ['\'] + + Sets the characters to stop auto closing. For example, when set to + ['\', '#'], the plugin will not automatically close `#'` + * g:AutoPairsMoveCharacter Default: "()[]{}\"'" diff --git a/plugin/auto-pairs.vim b/plugin/auto-pairs.vim index af5eb32..4b0e951 100644 --- a/plugin/auto-pairs.vim +++ b/plugin/auto-pairs.vim @@ -100,6 +100,10 @@ if !exists('g:AutoPairsSmartQuotes') let g:AutoPairsSmartQuotes = 1 endif +if !exists('g:AutoPairsIgnoreCharacters') + let g:AutoPairsIgnoreCharacters = ['\'] +endif + " 7.4.849 support U to avoid breaking '.' " Issue talk: https://github.com/jiangmiao/auto-pairs/issues/3 " Vim note: https://github.com/vim/vim/releases/tag/v7.4.849 @@ -204,8 +208,8 @@ func! AutoPairsInsert(key) let [before, after, afterline] = s:getline() - " Ignore auto close if prev character is \ - if before[-1:-1] == '\' + " Ignore auto close if prev character is in g:AutoPairsIgnoreCharacters + if index(g:AutoPairsIgnoreCharacters, prev_char) != -1 return a:key end @@ -332,7 +336,6 @@ func! AutoPairsDelete() return "\" endf - " Fast wrap the word in brackets func! AutoPairsFastWrap() let c = @"