Retain cursor position on close (#27)

This however doesn't work if Goyo window is closed with `:q`
This commit is contained in:
Junegunn Choi
2014-04-28 12:29:33 +09:00
parent ed3d591346
commit 5bea57ebf5

View File

@@ -244,6 +244,8 @@ function! s:goyo_off()
let goyo_disabled_airline = t:goyo_disabled_airline let goyo_disabled_airline = t:goyo_disabled_airline
let goyo_disabled_powerline = t:goyo_disabled_powerline let goyo_disabled_powerline = t:goyo_disabled_powerline
let goyo_disabled_lightline = t:goyo_disabled_lightline let goyo_disabled_lightline = t:goyo_disabled_lightline
let goyo_orig_buffer = t:goyo_master
let [line, col] = [line('.'), col('.')]
if tabpagenr() == 1 if tabpagenr() == 1
tabnew tabnew
@@ -252,6 +254,9 @@ function! s:goyo_off()
endif endif
tabclose tabclose
execute 'normal! '.s:orig_tab.'gt' execute 'normal! '.s:orig_tab.'gt'
if winbufnr(0) == goyo_orig_buffer
execute printf('normal! %dG%d|', line, col)
endif
let wmh = remove(goyo_revert, 'winminheight') let wmh = remove(goyo_revert, 'winminheight')
let wh = remove(goyo_revert, 'winheight') let wh = remove(goyo_revert, 'winheight')