Merge pull request #157 from davepagurek/fix-overwriting-register
Fix overwriting copied text when recentering
This commit is contained in:
commit
ea8ee08f44
@ -380,27 +380,23 @@ function! AutoPairsReturn()
|
||||
let cur_char = line[col('.')-1]
|
||||
if has_key(b:AutoPairs, prev_char) && b:AutoPairs[prev_char] == cur_char
|
||||
if g:AutoPairsCenterLine && winline() * 3 >= winheight(0) * 2
|
||||
" Use \<BS> instead of \<ESC>cl will cause the placeholder deleted
|
||||
" incorrect. because <C-O>zz won't leave Normal mode.
|
||||
" Use \<DEL> is a bit wierd. the character before cursor need to be deleted.
|
||||
" Adding a space, recentering, and deleting it interferes with default
|
||||
" whitespace-removing behavior when exiting insert mode.
|
||||
let cmd = "\<ESC>zzcc"
|
||||
" Recenter before adding new line to avoid replacing line content
|
||||
let cmd = "zz"
|
||||
end
|
||||
|
||||
" If equalprg has been set, then avoid call =
|
||||
" https://github.com/jiangmiao/auto-pairs/issues/24
|
||||
if &equalprg != ''
|
||||
return "\<ESC>O".cmd
|
||||
return "\<ESC>".cmd."O"
|
||||
endif
|
||||
|
||||
" conflict with javascript and coffee
|
||||
" javascript need indent new line
|
||||
" coffeescript forbid indent new line
|
||||
if &filetype == 'coffeescript' || &filetype == 'coffee'
|
||||
return "\<ESC>k==o".cmd
|
||||
return "\<ESC>".cmd."k==o"
|
||||
else
|
||||
return "\<ESC>=ko".cmd
|
||||
return "\<ESC>".cmd."=ko"
|
||||
endif
|
||||
end
|
||||
return ''
|
||||
|
Loading…
Reference in New Issue
Block a user