mirror of
https://github.com/junegunn/goyo.vim.git
synced 2025-11-16 07:13:50 -05:00
Retain cursor position on close (#27)
This however doesn't work if Goyo window is closed with `:q`
This commit is contained in:
@@ -244,6 +244,8 @@ function! s:goyo_off()
|
||||
let goyo_disabled_airline = t:goyo_disabled_airline
|
||||
let goyo_disabled_powerline = t:goyo_disabled_powerline
|
||||
let goyo_disabled_lightline = t:goyo_disabled_lightline
|
||||
let goyo_orig_buffer = t:goyo_master
|
||||
let [line, col] = [line('.'), col('.')]
|
||||
|
||||
if tabpagenr() == 1
|
||||
tabnew
|
||||
@@ -252,6 +254,9 @@ function! s:goyo_off()
|
||||
endif
|
||||
tabclose
|
||||
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 wh = remove(goyo_revert, 'winheight')
|
||||
|
||||
Reference in New Issue
Block a user