mirror of
https://github.com/jiangmiao/auto-pairs.git
synced 2025-04-21 20:18:48 +08:00
fix of vimscript quote by lemeb
Squashed commit of the following: commit 17bc0d0fe3bf88d1906faf6c1faed2641f399b84 Author: Léopold Mebazaa <lemeb@users.noreply.github.com> Date: Fri Oct 11 22:30:23 2019 -0400 Return to sanity commit b1c7fea82500d762471f939f6028f8fa8cc921cf Author: Léopold Mebazaa <lemeb@users.noreply.github.com> Date: Fri Oct 11 22:28:58 2019 -0400 Added logging for debug commit 562a72ea88e0aceeda8b20c1244fd038650d02c5 Author: Léopold Mebazaa <lemeb@users.noreply.github.com> Date: Fri Oct 11 18:57:41 2019 -0400 Hypothesis correct, turns out commit c126e3e98968c9cb291de1d3c80bbde099fa867f Author: Léopold Mebazaa <lemeb@users.noreply.github.com> Date: Fri Oct 11 18:53:32 2019 -0400 hypothesis 1: multiline is culprit commit 64966a9799551057c86d1d2292d5d5ab205acef9 Author: Léopold Mebazaa <lemeb@users.noreply.github.com> Date: Fri Oct 11 18:36:24 2019 -0400 Added log to debug AutoPairDelete()] commit 5f254b3c31980d4919be3f5f337b0c6fc252f9ff Author: Léopold Mebazaa <lemeb@users.noreply.github.com> Date: Fri Oct 11 12:51:49 2019 -0400 Update auto-pairs.vim
This commit is contained in:
parent
f6830ee765
commit
00a2857040
@ -21,9 +21,12 @@ func! AutoPairsDefaultPairs()
|
||||
if exists('b:autopairs_defaultpairs')
|
||||
return b:autopairs_defaultpairs
|
||||
end
|
||||
" Added a more complex regex to capture in-line VimL comments
|
||||
let no_quotes = '(\\\"|[^"])*'
|
||||
let com_inl = '|^("'.no_quotes.'"*|[^"])* \zs"\ze'.no_quotes.'$'
|
||||
let r = copy(g:AutoPairs)
|
||||
let allPairs = {
|
||||
\ 'vim': {'\v^\s*\zs"': ''},
|
||||
\ 'vim': {'\v^\s*\zs"'.com_inl: ''},
|
||||
\ 'rust': {'\w\zs<': '>', '&\zs''': ''},
|
||||
\ 'php': {'<?': '?>//k]', '<?php': '?>//k]'}
|
||||
\ }
|
||||
@ -221,7 +224,7 @@ func! AutoPairsInsert(key)
|
||||
" when <!-- is detected the inserted pair < > should be clean up
|
||||
let target = ms[1]
|
||||
let openPair = ms[2]
|
||||
if len(openPair) == 1 && m == openPair
|
||||
if (len(openPair) == 1 && m == openPair) || (close == '')
|
||||
break
|
||||
end
|
||||
let bs = ''
|
||||
@ -289,7 +292,6 @@ func! AutoPairsInsert(key)
|
||||
end
|
||||
endfor
|
||||
|
||||
|
||||
" Fly Mode, and the key is closed-pairs, search closed-pair and jump
|
||||
if g:AutoPairsFlyMode && a:key =~ '\v[\}\]\)]'
|
||||
if search(a:key, 'We')
|
||||
@ -307,8 +309,9 @@ func! AutoPairsDelete()
|
||||
|
||||
let [before, after, ig] = s:getline()
|
||||
for [open, close, opt] in b:AutoPairsList
|
||||
let rest_of_line = opt['multiline'] ? after : ig
|
||||
let b = matchstr(before, '\V'.open.'\v\s?$')
|
||||
let a = matchstr(after, '^\v\s*\V'.close)
|
||||
let a = matchstr(rest_of_line, '^\v\s*\V'.close)
|
||||
if b != '' && a != ''
|
||||
if b[-1:-1] == ' '
|
||||
if a[0] == ' '
|
||||
@ -495,7 +498,7 @@ func! AutoPairsInit()
|
||||
let c = close[0]
|
||||
let opt = {'mapclose': 1, 'multiline':1}
|
||||
let opt['key'] = c
|
||||
if o == c
|
||||
if o == c || len(c) == 0
|
||||
let opt['multiline'] = 0
|
||||
end
|
||||
let m = matchlist(close, '\v(.*)//(.*)$')
|
||||
|
Loading…
x
Reference in New Issue
Block a user