tpope / vim-obsession

obsession.vim: continuously updated session files
http://www.vim.org/scripts/script.php?script_id=4472
1.74k stars 68 forks source link

Why does obsession add tabpages to sessionoptions? #32

Closed blankname closed 7 years ago

blankname commented 7 years ago

https://github.com/tpope/vim-obsession/blob/master/plugin/obsession.vim#L63

tpope commented 7 years ago

I guess the best way to put it is that if obsession didn't do that, it would behave very weirdly, capturing only the most recently focused tab. It would certainly be possible to make a smarter plugin that acts on a per tab basis, but I have no idea how feasible it would be to retrofit it onto obsession.

blankname commented 7 years ago

Shouldn't the saving of tabs be up to the user's sessionoptions? Or could there be a setting to opt out of this behavior?

Saving tabs seems to interact poorly with 'powerman/vim-plugin-viewdoc', it ends up restoring empty tabs in place of help pages that were open.

tpope commented 7 years ago

So if I took away tabpages, you'd have to be careful to make sure the correct tab was focused before exiting, otherwise all you would get on restore would be a single blank 'powerman/vim-plugin-viewdoc' tab. I think that's worse then having to close the occasional blank tab.

I won't completely rule out adding an option, but I would highly recommend investigating making 'powerman/vim-plugin-viewdoc' a bit smarter about sessions first.

tpope commented 7 years ago

Also, you could certainly rig up a SessionLoadPost autocommand to close all blank tabs, if you are ok with a hack solution. I think that's better than adding an option.

blankname commented 7 years ago

I'm okay with the hacky solution after https://github.com/neovim/neovim/issues/6308. Thanks.