Open alihardan opened 5 years ago
I just ran into the same thing and there is a comment in the script saying that switching the line number in the original file does not work when using :q
I fixed this with saving line/col on QuitPre
and restoring in my goyo_leave
(inspired by this example). One thing I don't know yet is why only the line number is restored, but not the column, but that isn't really a problem for me so didn't investigate.
function s:goyo_enter()
let b:quitting = 0
autocmd QuitPre <buffer> let b:quitting = 1 | let b:line_pos = line('.') | let b:col_pos = col('.')
endfunction
function s:goyo_leave()
if b:quitting
call cursor(b:line_pos, b:col_pos)
endif
endfunction
autocmd! User GoyoEnter call <SID>goyo_enter()
autocmd! User GoyoLeave call <SID>goyo_leave()
Thanks mihalyr, solved the problem (for me) :+1:
When I close Goyo using
:q
, buffer cursor jumps to first line of document. But when I use:Goyo
, It doesn't jump.My .vimrc: