junegunn / goyo.vim

:tulip: Distraction-free writing in Vim
MIT License
4.5k stars 115 forks source link

Go back to the correct tab when disabling Goyo #24

Closed ghost closed 10 years ago

ghost commented 10 years ago

If you have more than one tab open and you enable Goyo in any of them but the last one, if you then disable Goyo, Vim goes back to the last tab of the list, not to the tab you were working on. I have fixed it this way but I don't know if there's a cleaner way to do it?

function! s:goyo_before()
    let g:tab_number = tabpagenr()-1
endfunction

function! s:goyo_after()
    exe 'norm '.g:tab_number.'gt'
endfunction
junegunn commented 10 years ago

I've been unaware of this issue. I think it should be handled by default. I'll update the code and let you know. Thanks.

junegunn commented 10 years ago

Fixed. Please let me know if you see any problems.

ghost commented 10 years ago

Thanks for the quick fix however I've just tried and it doesn't seem to be working. I've looked at the code and I can't see any reason why though.

Edit: Woops, it actually does work. There was a conflict with what I put in one of my callbacks. Sorry!