junegunn / goyo.vim

:tulip: Distraction-free writing in Vim
MIT License
4.52k stars 116 forks source link

`:q` [in goyo] moves cursor to top of buffer in original window #64

Closed orbisvicis closed 9 years ago

orbisvicis commented 9 years ago

Let me know if extra info required.

junegunn commented 9 years ago

Running goyo is effectively equivalent to doing the following.

" Open a buffer

" Open it in a new tab
:tab split

" Move the cursor

" Close the tab
:q

The cursor in the original window is not synchronized. Goyo tries to restore the position of the buffer when it's possible, but it doesn't work when you close Goyo window with :q, it's a known issue. Closing Goyo window by leaving the tab (e.g. gt) will work.

See: https://github.com/junegunn/goyo.vim/blob/master/autoload/goyo.vim#L309-L312