junegunn / goyo.vim

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

Can't open a new tab when Goyo is active #26

Closed ghost closed 10 years ago

ghost commented 10 years ago

I'm having another minor issue with Goyo. I have my Vim set up to open new files in tabs. Oftentimes, when I'm writing, I want to quickly check something out in another file. But when Goyo is on, if I do that, all it will do is to disable Goyo. I have to open the file once again to actually load it and to reenable Goyo when I'm done with it and back to my writing tab. Do you think there would be a way to fix this?

Thanks again for a great plugin!

Maxime

junegunn commented 10 years ago

Place autocmd! goyo TabLeave in your before-callback. This will prevent Goyo from being closed when you move between tabs. (This is not the recommended way of using Goyo, so there may be some side-effects.)

ghost commented 10 years ago

Thanks, it works great! I can now open any file, take a quick look at it and I'm back where I should when I quit it. Sorry that I keep using Goyo in an unexpected way! May I ask how you do that, to take a glance at another file? Do you remember to quit Goyo before opening the other one? Or do you simply never do it?

junegunn commented 10 years ago

Hmm, okay, in fact I don't use Goyo all that often. I mostly use it when I edit markdown files, in which case I usually don't need to look at other files. But when I have to, simple :e other-filename command will open the file in the Goyo window without affecting the layout (set hidden is on), and when I'm done, CTRL-^ will take me back to the file I was editing.