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]
|
let cur_char = line[col('.')-1]
|
||||||
if has_key(b:AutoPairs, prev_char) && b:AutoPairs[prev_char] == cur_char
|
if has_key(b:AutoPairs, prev_char) && b:AutoPairs[prev_char] == cur_char
|
||||||
if g:AutoPairsCenterLine && winline() * 3 >= winheight(0) * 2
|
if g:AutoPairsCenterLine && winline() * 3 >= winheight(0) * 2
|
||||||
" Use \<BS> instead of \<ESC>cl will cause the placeholder deleted
|
" Recenter before adding new line to avoid replacing line content
|
||||||
" incorrect. because <C-O>zz won't leave Normal mode.
|
let cmd = "zz"
|
||||||
" 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"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
" If equalprg has been set, then avoid call =
|
" If equalprg has been set, then avoid call =
|
||||||
" https://github.com/jiangmiao/auto-pairs/issues/24
|
" https://github.com/jiangmiao/auto-pairs/issues/24
|
||||||
if &equalprg != ''
|
if &equalprg != ''
|
||||||
return "\<ESC>O".cmd
|
return "\<ESC>".cmd."O"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" conflict with javascript and coffee
|
" conflict with javascript and coffee
|
||||||
" javascript need indent new line
|
" javascript need indent new line
|
||||||
" coffeescript forbid indent new line
|
" coffeescript forbid indent new line
|
||||||
if &filetype == 'coffeescript' || &filetype == 'coffee'
|
if &filetype == 'coffeescript' || &filetype == 'coffee'
|
||||||
return "\<ESC>k==o".cmd
|
return "\<ESC>".cmd."k==o"
|
||||||
else
|
else
|
||||||
return "\<ESC>=ko".cmd
|
return "\<ESC>".cmd."=ko"
|
||||||
endif
|
endif
|
||||||
end
|
end
|
||||||
return ''
|
return ''
|
||||||
|
Loading…
Reference in New Issue
Block a user