tpope / vim-obsession

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

Enable Obsession if -S passed in arg. #69

Closed mikeslattery closed 2 years ago

mikeslattery commented 2 years ago

If -S is passed as an arg, automatically enable obsession.

if !empty(v:this_session) && !exists('g:this_obsession')
  Obsession
end

A user could also enable if v:this_session is set in .vimrc. I apologize if this has already been reported. I looked at similar tickets and none looked like the same thing.

I have this in my .vimrc to achieve this for now:

autocmd VimEnter * if !empty(v:this_session) && ObsessionStatus('on', 'off') == 'off' | Obsession | endif
tpope commented 2 years ago

This will happen automatically if the session file was created with Obsession. If not, well, I think it would be a little rude to silently override it.

mikeslattery commented 2 years ago

@tpope Thanks. That makes sense for default behavior.

Regardless of my suggested technical solution, I suppose my goal was to make obsession automatic for users that want that (like me). Maybe a very simple ObsessionEnable. Anyway, I've solved it for myself. Just a suggestion for other users.

Btw, I love your plugins, including this one, as well as your attitude towards limiting scope of said plugins.