fixes #23: Support typographer's quote pairs, such as ‘, ’, “, ”
This commit is contained in:
parent
1c5046f8c3
commit
9758a447cf
@ -72,9 +72,12 @@ function! AutoPairsInsert(key)
|
|||||||
end
|
end
|
||||||
|
|
||||||
let line = getline('.')
|
let line = getline('.')
|
||||||
let prev_char = line[col('.')-2]
|
let pos = col('.') - 1
|
||||||
let current_char = line[col('.')-1]
|
let next_chars = split(strpart(line, pos), '\zs')
|
||||||
let next_char = line[col('.')]
|
let current_char = get(next_chars, 0, '')
|
||||||
|
let next_char = get(next_chars, 1, '')
|
||||||
|
let prev_chars = split(strpart(line, 0, pos), '\zs')
|
||||||
|
let prev_char = get(prev_chars, -1, '')
|
||||||
|
|
||||||
let eol = 0
|
let eol = 0
|
||||||
if col('$') - col('.') <= 1
|
if col('$') - col('.') <= 1
|
||||||
@ -151,9 +154,11 @@ endfunction
|
|||||||
|
|
||||||
function! AutoPairsDelete()
|
function! AutoPairsDelete()
|
||||||
let line = getline('.')
|
let line = getline('.')
|
||||||
let current_char = line[col('.')-1]
|
let pos = col('.') - 1
|
||||||
let prev_char = line[col('.')-2]
|
let current_char = get(split(strpart(line, pos), '\zs'), 0, '')
|
||||||
let pprev_char = line[col('.')-3]
|
let prev_chars = split(strpart(line, 0, pos), '\zs')
|
||||||
|
let prev_char = get(prev_chars, -1, '')
|
||||||
|
let pprev_char = get(prev_chars, -2, '')
|
||||||
|
|
||||||
if pprev_char == '\'
|
if pprev_char == '\'
|
||||||
return "\<BS>"
|
return "\<BS>"
|
||||||
|
Loading…
Reference in New Issue
Block a user