Merge pull request #1 from michaelquinn32/patch

Adding a new global variable
This commit is contained in:
Michael Quinn
2019-07-30 16:28:17 -07:00
committed by GitHub
2 changed files with 17 additions and 6 deletions

View File

@ -249,6 +249,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 `#'`
Buffer Level Pairs Setting
--------------------------

View File

@ -74,6 +74,10 @@ if !exists('g:AutoPairsSmartQuotes')
let g:AutoPairsSmartQuotes = 1
endif
if !exists('g:AutoPairsIgnoreCharacters')
let g:AutoPairsIgnoreCharacters = ['\']
endif
" 7.4.849 support <C-G>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
@ -111,8 +115,8 @@ function! AutoPairsInsert(key)
let eol = 1
end
" Ignore auto close if prev character is \
if prev_char == '\'
" Ignore auto close if prev character is in g:AutoPairsIgnoreCharacters
if index(g:AutoPairsIgnoreCharacters, prev_char) != -1
return a:key
end
@ -231,7 +235,7 @@ function! AutoPairsDelete()
let prev_char = get(prev_chars, -1, '')
let pprev_char = get(prev_chars, -2, '')
if pprev_char == '\'
if index(g:AutoPairsIgnoreCharacters, pprev_char) != -1
return "\<BS>"
end