vim-session icon indicating copy to clipboard operation
vim-session copied to clipboard

auto_save only if there is an open session.

Open anirudhaku opened this issue 11 years ago • 6 comments

Currently, even if there is no session open, either default session is saved or user is prompted (depending of auto_save = 'yes' or 'prompt'). Is it possible to ignore auto_save if there is no open session?

Use Case: If user goes to a directory and opens a file just to read it, then there is no need to save the session. If user intends to maintain a session for a particular directory (e.g. directory contains a project user is working on) then he can 'SaveSession' once and then auto_save will kick in on every subsequent exit.

anirudhaku avatar Mar 25 '14 07:03 anirudhaku

Any thoughts???

anirudhaku avatar Apr 19 '14 17:04 anirudhaku

It's the exactly same thought I have when the very first time when I saw the prompt.

leira avatar Jun 24 '14 22:06 leira

this would be a very good feature :+1:

subhojit777 avatar Sep 22 '14 15:09 subhojit777

Currently I'm having the same problem... I really wish there could be some option to disable auto_save only when there was no active session.

cpixl avatar Feb 21 '15 00:02 cpixl

Looking on the source code, it looks like this is partially the current behaviour. The xolox#session#auto_save_periodic function will only save if there's some session open (#L478), and the xolox#session#auto_save function will only save the "default" session if there isn't any other saved session AND the g:session_default_overwrite option is not set (#L444).

Anyway, I guess this behaviour could be better documented.

cpixl avatar Feb 21 '15 03:02 cpixl

I will be adding my own fix to this branch here https://github.com/dylan-chong/vim-session/commits/session_autosave_only_with_explicit_session

dylan-chong avatar Jun 19 '18 10:06 dylan-chong