Fix centerscroll
This commit is contained in:
parent
aa7cf035ff
commit
b3ffefc07c
|
@ -2,17 +2,4 @@
|
|||
augroup KeepCentered
|
||||
autocmd!
|
||||
autocmd CursorMoved * normal! zz
|
||||
autocmd TextChangedI * call InsertRecenter()
|
||||
augroup END
|
||||
|
||||
function InsertRecenter() abort
|
||||
let at_end = getcursorcharpos()[2] > len(getline('.'))
|
||||
normal! zz
|
||||
|
||||
" Fix position of cursor at end of line
|
||||
if at_end
|
||||
let cursor_pos = getcursorcharpos()
|
||||
let cursor_pos[2] = cursor_pos[2] + 1
|
||||
call setcursorcharpos(cursor_pos[1:])
|
||||
endif
|
||||
endfunction
|
||||
|
|
Loading…
Reference in a new issue